I have a large dataframe that I need to make and annotate subplots from, see below. Everything seems ok, I still have some work to do on the x and y ticks but otherwise it seems pretty right, except, I can't get the annotation for each subplot to fall on the appropriate subplot. The annotations are all taken from the list 'df_cols' defined at the start. All of the annotation are plotted, but on top of one another in the lowest subplot, which is also the last subplot in the list.
df_cols = ['WC_015', 'WC_030', 'WC_046', 'WC_061', 'WC_076', 'WC_091', 'WC_107', 'WC_122', 'WC_137', 'WC_152', 'WC_168', 'WC_183', 'WC_213', 'WC_244', 'WC_274', 'WC_305', 'WC_366', 'WC_427', 'WC_488', 'WC_518']
fig, axs = plt.subplots(20, 1, figsize=(50,30)) #, sharex=True, sharey=True)
for k, col in enumerate(df_cols):
df[col].plot(ax=axs[k])
plt.annotate(df_cols[k], xy=(.01, .115), xycoords='axes fraction', fontsize=15, rotation=90, color='red') #plt.annotate(df_cols[k], xy=(.01, .115), xycoords='axes fraction', fontsize=15, rotation=90, color='red')
fig.subplots_adjust(hspace=0)
plt.suptitle ('Volumetric Moisture Content', fontsize=40, y=.91)
plt.ylabel('Volumetric Moisture Content (m3/m3)', fontsize=30, y=10.0)
plt.xlabel('Date', fontsize=30)
plt.savefig('Moisture_Content_Plots.pdf', dpi=100, bbox_inches='tight')
It seems like it should iterate through the labels with the loop that makes the subplots, but I can't get it there.


pyplotfunctions work on the current axes. If you do not explicitly set the current axes withplt.scathen it will be the most recently created one. You could set the current axes in your loop or, more simply, useaxs[k].annotate.pyplotfunctions are mostly wrappers of figure and axes methods, see matplotlib.org/stable/users/explain/figure/api_interfaces.htmlsharey=True, but the limits of the 20 y axes are different in the figure you've posted.