我试图用matplotlib和pandas来显示表示工作量的时间序列线。在
我已经将DF的toall覆盖在一个图中,但是当我这样做时,python似乎剥离了日期的x轴并输入了一些数字。(我不确定这些数据是从哪里来的,但可以猜测,并非所有的日子都包含相同的数据,因此python恢复使用索引id号)。如果我把其中的任何一个画出来,他们就会得出x轴上的日期。在
任何提示或解决方案,使x轴显示日期的多重绘图将不胜感激。在
我用的代码是
fig = pl.figure()
ax = fig.add_subplot(111)
ax.plot(b342,color='black')
ax.plot(b343,color='blue')
ax.plot(b344,color='red')
ax.plot(b345,color='green')
ax.plot(b346,color='pink')
ax.plot(fi,color='yellow')
plt.show()
我找到了一个我想要的答案,似乎plt.绘图并没有使用日期作为x轴,但是使用pandas文档调用它确实起到了作用。在
表演()
我想知道有没有人知道该怎么换标签?在
一种选择是根据DataFrame索引手动指定x轴,然后使用matplotlib直接绘图。在
另一个选择是使用Pandas连接数据帧和绘图。如果在加载数据或通过
^{pr2}$DataFrame.rename
为“FishEffort”字段指定正确的标签名称,则标签将自动指定。在相关问题 更多 >
编程相关推荐