I am creating a 6 panel subplot with each plot showing a different time step for my data. I am having trouble creating a loop that plots each time into one of the panels. I have been able to produce the 6 plots as well as select the proper times to plot, but having issues trying to figure out how to make both of these work together in a loop. Currently I have:
ax1.contour(thpert_neg.sel(xh = slice(xstart,xend), yh = slice(ystart,yend), time=times[4]), color = 'blue', linewidth = lw, levels = np.arange(-1,-.60,.05))
ax2.contour(thpert_neg.sel(xh = slice(xstart,xend), yh = slice(ystart,yend), time=times[8]), color = 'blue', linewidth = lw, levels = np.arange(-1,-.60,.05))
ax3.contour(thpert_neg.sel(xh = slice(xstart,xend), yh = slice(ystart,yend), time=times[12]), color = 'blue', linewidth = lw, levels = np.arange(-1,-.60,.05))
ax4.contour(thpert_neg.sel(xh = slice(xstart,xend), yh = slice(ystart,yend), time=times[16]), color = 'blue', linewidth = lw, levels = np.arange(-1,-.60,.05))
ax5.contour(thpert_neg.sel(xh = slice(xstart,xend), yh = slice(ystart,yend), time=times[20]), color = 'blue', linewidth = lw, levels = np.arange(-1,-.60,.05))
ax6.contour(thpert_neg.sel(xh = slice(xstart,xend), yh = slice(ystart,yend), time=times[24]), color = 'blue', linewidth = lw, levels = np.arange(-1,-.60,.05))
Which is clearly not great. Here is one of the many iterations of what I have tried to use instead:
fig, axes = plt.subplots(2, 3)
ax1, ax2,ax3, ax4, ax5, ax6 = axs
for tt in range(0,25,4): ### This is for each hour
this_time = times[tt]
this_ax = axs
for axn in axs:
plt.contourf(thpert_neg.sel(xh = slice(xstart, xend), zh = slice(zstart, zend), time=this_time))