我有一个由时间范围、库存和文本计数组成的数据框作为列。数据帧如下所示
Time Stock Text
0 00:00 - 01:00 BBNI 371
1 00:00 - 01:00 BBRI 675
2 00:00 - 01:00 BBTN 136
3 00:00 - 01:00 BMRI 860
4 01:00 - 02:00 BBNI 936
5 01:00 - 02:00 BBRI 1325
6 01:00 - 02:00 BBTN 316
7 01:00 - 02:00 BMRI 1630
我想用下面的代码绘制一个线形图:
df=tweetdatacom.groupby(["Time","Stock"])[["Text"]].count().reset_index()
plt.figure(figsize=(10,5))
line=sn.lineplot(x="Time", y="Text",hue="Stock",palette=["green","orange","red","blue"],marker="o",data=df)
plt.xticks(size=5,rotation=45, horizontalalignment='right',fontweight='light',fontsize='large')
plt.xlabel('Time Interval',size=12)
plt.ylabel('Total Tweets',size=12)
现在,我想把每个标记的值放在绘图上,我怎么做
多谢各位
使用
ax.text
循环遍历数据数。我只是用提供给我的数据创建这个,所以我省略了一些处理相关问题 更多 >
编程相关推荐