I found some code to generate a set of small multiples and it is working perfectly.
fig, axes = plt.subplots(6,3, figsize=(21,21))
fig.subplots_adjust(hspace=.3, wspace=.175)
for ax, data in zip(axes.ravel(), clean_sets):
ax.plot(data.ETo, "o")
The line for ax, data in zip(axes.ravel(), clean_sets):
contians .ravel()
but I do not understand what this is actually doing or why it is necessary.
If I take a look at the docs I find the following:
Return a contiguous flattened array.
A 1-D array, containing the elements of the input, is returned. A copy is made only if needed.
I guess the return that corresponds to axes from plt.subplot()
is a multidimensional array that can't be iterated over, but really I'm not sure. A simple explanation would be greatly appreciated.
What is the purpose of using .ravel()
in this case?