This question was closed just after I asked it, as it was deemed to be a duplicate. However, the suggested duplicate : How to plot in multiple subplots does not address my question, which is how to plot subplots in a subplot, i.e 'a number of subplots, each of which is made up of two (or more) subplots'.
I have this code, which plots individual plots (each with two subplots)
the number of plots is determined by the length of ev_ind
for ij in range(len(ev_ind)):
dfn=str('event_'+ev_ind.loc[ij,0].astype(str))
locals()[dfn]=pd.DataFrame(columns=['datetime', 'aaj', 'cbd', 'cbu','dmr', 'fms'])
edfn=str('event_'+ev_ind.loc[ij,0].astype(str)+'_rain')
locals()[edfn]=pd.read_csv(edname+dfn+'_edf.csv', usecols=[1,2,3,4,5,6,7,8,9,10,11])
for xx in gl2:
locals()[dfn]['datetime']=pd.read_csv(edname+dfn+'_'+xx+'.csv', usecols=['datetime'])
locals()[dfn][xx]=pd.read_csv(edname+dfn+'_'+xx+'.csv', usecols=['depth'])
locals()[dfn]['datetime']=locals()[dfn]['datetime'].astype('datetime64[ns]')
locals()[edfn]['datetime']=locals()[edfn]['datetime'].astype('datetime64[ns]')
sd=locals()[dfn]['datetime'].iloc[0]
ed=locals()[dfn]['datetime'].iloc[-1]
sds=sd.strftime('%b %d %H:%M')
eds=ed.strftime('%b %d %H:%M')
subfig=fig.subfigures(row+1,col+1)
#axs[row,col],(ax1, ax2)= fig.subfigures()
#axs[row,col], (ax1, ax2)=plt.subplots(2,1, sharex=True)
#axs.suptitle(f'Cluster mean and river levels for {gname} event {ev_ind.loc[ij,0]} in period {sds} to {eds}')
#subfigij, (ax1, ax2)=subfig.subplots(2,1, sharex=True)
figij, (ax1, ax2)=plt.subplots(2,1, sharex=True)
figij.suptitle(f'Cluster mean and river levels for {gname} event {ev_ind.loc[ij,0]} in period {sds} to {eds}')
for xx in gl2:
ax1.plot(locals()[dfn]['datetime'], locals()[dfn][xx]*100, label=gl[gl2.index(xx)], color= colour2[gl2.index(xx)])
ax1.title.set_text('stream level')
ax1.set_ylabel('stream depth (cm)', rotation=90)
ax1.legend(title='Stream name',bbox_to_anchor=(1,1), loc="upper left", fontsize=10, title_fontsize=12)
ax1.xaxis.set_minor_formatter(plt.NullFormatter())
ax2.plot(locals()[edfn].datetime, locals()[edfn].ic_mean, label='ic mean', color= 'red')
ax2.plot(locals()[edfn].datetime, locals()[edfn].mc_mean, label='mc mean', color= 'chocolate')
ax2.plot(locals()[edfn].datetime, locals()[edfn].imd_mean, label='imd mean', color= 'orange')
ax2.plot(locals()[edfn].datetime, locals()[edfn].md_mean, label='md mean', color='navy')
ax2.plot(locals()[edfn].datetime, locals()[edfn].oak_mean, label='oak mean', color= 'purple')
ax2.plot(locals()[edfn].datetime, locals()[edfn].iloc[:,di], label= gname, color='black')
ax2.title.set_text('Guage readings')
ax2.legend(title='gauge name',bbox_to_anchor=(1,1), loc="upper left", fontsize=10, title_fontsize=12)
ax2.set_ylabel('Rain (mm)', rotation=90)
ax2.set_xlabel('Datetime')
ax2.tick_params(axis='x',rotation=90)
plt.subplots_adjust(right=0.7)
plt.show()
what I would like to do is plot each of these plots on one plot. I have tried all sorts of different things, as you can see by the commented out lines, but cannot get anything to work!