如何使用 Pandas 数据框为子图设置 ylim?

How do I set ylim for subplots using Pandas dataframe?

我有不止这些数据框列。 我可以使用 ax=plt.gca() 设置底部图形,但是如何设置其他子图的限制?

下面是我用于绘图的代码。

SomeDataFrame.plot(subplots=True, style=style, title='%s' % macID.upper(), grid=True, legend=True,)
ax = plt.gca()
ax.ylim=([lowlimit, highlimit])

plt.show()

SomeDataFrame.plot() returns 它创建的子图列表。使用此 return 值,您可以访问和操作它们。

mysubplots = SomeDataFrame.plot(subplots=True, style=style, title='%s' % macID.upper(), grid=True, legend=True,)
firstplot = mysubplots[0]
firstplot.set_ylim=([lowlimit, highlimit])
secondplot = mysubplots[1]
secondplot.set_ylim=([lotherowlimit, otherhighlimit])

plt.show()