猫史档案馆


为什么我做的聊天室发送一次出现两条信息?

用户:胖达and胖达and查看:5 回复:5 评论:5 创建时间:2022-12-24T09:24:31


这是代码center_image这是效果center_image


回复

上一页1 页 / 共 1下一页
trashtrash

......

点赞0


评论


2396023960

为什么我的不会出现这种情况?

点赞0


评论


wowhhhwowhhh

emotion_喵

n = 12
X = np.arange(n)

Y1 = (1-X/n)*np.random.uniform(0.5,1.0,n)

Y1 = (1-X/n)*np.random.uniform(0.5,1.0,n)



# 由于返回值,进过提取是str,操作小数位数不方便,外面提前处理好

p1 = plt.bar(X,np.round(Y1,2),width=0.8,facecolor='deeppink',label='uniform')



def autolabel(rects):

    """Attach a text label above each bar in *rects*, displaying its height."""

    for rect in rects:

        height = rect.get_height()

        plt.annotate('{}'.format(height),

                    xy=(rect.get_x() + rect.get_width() / 2, height),

                    xytext=(0, 3),  # 3 points vertical offset

                    textcoords="offset points",

                    ha='center', va='bottom')



# 为什么有两个hight

def add_labels(rects):

    for rect in rects:

        height = rect.get_height()

        plt.text(rect.get_x() + rect.get_width()/2,height,height, ha='center', va='bottom')

        rect.set_edgecolor('white')



# add_labels(p1)



autolabel(p1)



plt.legend(loc='best')

plt.show()   

点赞0


评论


林夕狐林夕狐

大佬的好高级,我看不懂......

点赞0


评论


ELA7096ELA7096

这代码没问题呀???

应该是你卡了点了两次聊天按钮

点赞0


评论