I am having an issue trying to plot 6 figures in a 2 column, 3 row fashion. I have the following code:
fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(nrows=3, ncols=2, sharex=True)
ax1.plot(df_truth.index, df_truth[stat], label = 'Fine')
ax1.plot(df_truth.index, df_Obs[stat], label = 'Observation')
ax1.plot(df_truth.index, df_T12_0hr[stat], label = 'T12_0hr')
ax2.plot(df_truth.index, df_truth[stat], label = 'Fine')
ax2.plot(df_truth.index, df_Obs[stat], label = 'Observation')
ax2.plot(df_truth.index, df_T12_12hr[stat], label = 'T12_12hr')
ax3.plot(df_truth.index, df_truth[stat], label = 'Fine')
ax3.plot(df_truth.index, df_Obs[stat], label = 'Observation')
ax3.plot(df_truth.index, df_T12_24hr[stat], label = 'T12_24hr')
ax4.plot(df_truth.index, df_truth[stat], label = 'Fine')
ax4.plot(df_truth.index, df_Obs[stat], label = 'Observation')
ax4.plot(df_truth.index, df_T3_0hr[stat], label = 'T3_0hr')
ax5.plot(df_truth.index, df_truth[stat], label = 'Fine')
ax5.plot(df_truth.index, df_Obs[stat], label = 'Observation')
ax5.plot(df_truth.index, df_T12_0hr[stat], label = 'T3_12hr')
ax6.plot(df_truth.index, df_truth[stat], label = 'Fine')
ax6.plot(df_truth.index, df_Obs[stat], label = 'Observation')
ax6.plot(df_truth.index, df_T3_24hr[stat], label = 'T3_24hr')
plt.savefig(figDir+stat+'_watlev_ts.png', bbox_inches = 'tight', pad_inches = 0.02)
plt.close()
print('Plotting ' + str(stat) )
No matter what I try I get an error saying either too many or too few values to unpack. What I have tried:
fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(nrows=3, ncols=2, sharex=True)
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(3, 2, sharex=True)
fig, ax1, ax2, ax3, ax4, ax5, ax6 = plt.subplots(3,2, sharex=True)
fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(3,2, sharex=True)
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(6, sharex=True)
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(3, 2)
fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(3, 2, sharex=True)
fig, ax1, ax2, ax3, ax4, ax5, ax6 = plt.subplots(nrows=3, ncols=2, sharex=True)
This works but gives me one column
fig, (ax1, ax2, ax3, ax4, ax5, ax6) = plt.subplots(6, sharex=True)
fig, ((ax1, ax2), (ax3, ax4), (ax5, ax6)) = plt.subplots(nrows=3, ncols=2, sharex=True)