0

Is there a way I can access the axes returned by pandas.DataFrame.plot(subplots=True)? I'd like to give each plot a title (and access other attributes), but my current attempts only affect the last subplot.

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

I have also tried using matplotlib.subplots() to create the subplots individually but this lead to the shared x-axis no longer only by at the intersection of all the Series being plotted.

1 Answer 1

2

"Returned" means it is the result of the call to plot. You can just store it in a variable:

ax = svv[['Flow2 L/s','GWT','DOC mg/L', 'Hgtot ng/L', 'MeHg ng/L']].dropna().plot(subplots=True, figsize=(20, 20))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.