我正在使用 matplotlib.pyplot 来可视化我的数据。在熊猫中,我有 'hour' 和'favourite_count'. 小时的值从 0 到 24。favourite_count是一个连续变量。我想要的是绘制一个条形图,它可视化favourite_count每小时的平均值。目前我正在绘制一个基本图形,如下所示。在 y 轴上绘制了favourite_count每小时的总和/最大值(我不确定是哪个)。如何绘制可视化小时 vs 的图表average_favorite_count_for_hourplt.bar(result['hour'], result['favourite_count'])plt.xlabel('hour')plt.ylabel('favourite_count')plt.title('hour vs popularity', y=1.1)plt.grid()plt.show()
添加回答
举报
0/150
提交
取消