【发布时间】:2020-02-13 10:23:54
【问题描述】:
我想根据月份和年份绘制平均值。
我的数据有两列(计数、平均值)和日期作为索引。
这里显示的图类似于我的图,其中 x 是年,y 是平均值
这是我的代码
import matplotlib.pyplot as plt
diet = df[['mean']]
diet.plot(figsize=(20,10), linewidth=5, fontsize=20 ,marker='<')
plt.xlabel('Year', fontsize=20);
plt.xlabel('Month/Year')
plt.ylabel('mean')
【问题讨论】:
-
这能回答你的问题吗? Annotate Time Series plot in Matplotlib
-
@DizietAsahi 不多,因为我想添加列而不是一个词
-
好吧,你必须运行一个循环来为你的 df 的每一行添加一个单词。对不起。
标签: python matplotlib