【发布时间】:2021-03-05 17:50:22
【问题描述】:
对于一个小的 jupyter notebook 小部件,我尝试了以下方法:
with output:
fig, ax = plt.subplots(constrained_layout=True, figsize=(6, 4))
# move the toolbar to the bottom
fig.canvas.toolbar_position = 'bottom'
ax.grid(True)
line, = ax.plot(df.index, init_data, initial_color,)
ax.set_ylabel('CH4_HYD1')
ax.set_ylabel('')
但是数据以一种奇怪的方式绘制。在隔离绘图方法并将其与 pandas 默认值进行比较时,pandas 绘图正确显示数据。
df['CH4_HYD1'].plot()
plt.plot(['CH4_HYD1'])
我想使用轴绘图方法来生成具有多行不同特征的绘图。但是我找不到可能非常简单的错误...这里有什么区别?
【问题讨论】:
-
你能上传你的DataFrame吗?索引似乎有问题。
-
什么是“熊猫默认值”?你的输入是什么?请阅读How do I ask a good question? 和How to make good reproducible pandas examples,然后编辑问题。
-
嘿,谢谢,indexind 有错误,我搞砸了。感谢您的提示!我该如何关闭这样的问题?
标签: python pandas matplotlib