访问 pandas.DataFrame.plot() 返回的子图轴
Access subplot axes returned by pandas.DataFrame.plot()
有什么方法可以访问 pandas.DataFrame.plot(subplots=True)
返回的轴?我想给每个情节一个标题(并访问其他属性),但我目前的尝试只影响最后一个子情节。
svv[['Flow2 L/s','GWT','DOC mg/L', 'Hgtot ng/L', 'MeHg ng/L']].dropna().plot(subplots=True, figsize=(20, 20))
plt.legend(loc='best')
ax[0].set_title('title1') # Doesn't alter any of the plots
ax[1].set_title('title2') # Doesn't alter any of the plots
plt.title('5 plots') # Title appears above the last plot
我也尝试过使用 matplotlib.subplots()
单独创建子图,但这导致共享 x-axis 不再仅在所有 Series
的交集处被绘制。
"Returned"表示它是调用plot
的结果。您可以将它存储在一个变量中:
ax = svv[['Flow2 L/s','GWT','DOC mg/L', 'Hgtot ng/L', 'MeHg ng/L']].dropna().plot(subplots=True, figsize=(20, 20))
有什么方法可以访问 pandas.DataFrame.plot(subplots=True)
返回的轴?我想给每个情节一个标题(并访问其他属性),但我目前的尝试只影响最后一个子情节。
svv[['Flow2 L/s','GWT','DOC mg/L', 'Hgtot ng/L', 'MeHg ng/L']].dropna().plot(subplots=True, figsize=(20, 20))
plt.legend(loc='best')
ax[0].set_title('title1') # Doesn't alter any of the plots
ax[1].set_title('title2') # Doesn't alter any of the plots
plt.title('5 plots') # Title appears above the last plot
我也尝试过使用 matplotlib.subplots()
单独创建子图,但这导致共享 x-axis 不再仅在所有 Series
的交集处被绘制。
"Returned"表示它是调用plot
的结果。您可以将它存储在一个变量中:
ax = svv[['Flow2 L/s','GWT','DOC mg/L', 'Hgtot ng/L', 'MeHg ng/L']].dropna().plot(subplots=True, figsize=(20, 20))