Is there a simple/clean way to iterate an array of axis returned by subplots like
nrow = ncol = 2 a = [] fig, axs = plt.subplots(nrows=nrow, ncols=ncol) for
The fig return value of plt.subplots has a list of all the axes. To iterate over all the subplots in a figure you can use:
fig
plt.subplots
nrow = 2 ncol = 2 fig, axs = plt.subplots(nrow, ncol) for i, ax in enumerate(fig.axes): ax.set_ylabel(str(i))
This also works for nrow == ncol == 1.
nrow == ncol == 1