我有不止这些数据框列。 我可以使用 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()
返回它创建的子图列表。使用此返回值,您可以访问和操作它们。
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()
关于python - 如何使用 Pandas 数据框为子图设置 ylim?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38204071/