如何更改 x 轴的间隔并将它们表示为字符串,此处为月份名称
How to change interval of x-axis and represent them as strings, here name of month
我有一个大小为一年 365 天的数组。它具有每天的平均温度。现在我想用 X 轴作为月来绘制它,但在图中代表所有 365 天。
默认情况下表示 x 轴为 50 的间隔。
plt.plot(avg_Chile,'^',label="Chile")
legend(framealpha=0.5)
plt.xticks(["Mar","Apr","May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb"])
ValueError:无法将字符串转换为浮点数:
类似于:
xticks([0,30,60,90], ['Jan', 'Feb', 'Mar'])
我有一个大小为一年 365 天的数组。它具有每天的平均温度。现在我想用 X 轴作为月来绘制它,但在图中代表所有 365 天。 默认情况下表示 x 轴为 50 的间隔。
plt.plot(avg_Chile,'^',label="Chile")
legend(framealpha=0.5)
plt.xticks(["Mar","Apr","May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb"])
ValueError:无法将字符串转换为浮点数:
类似于:
xticks([0,30,60,90], ['Jan', 'Feb', 'Mar'])