[Matplotlib-users] get nrows and ncols from Figure

aeuii at posteo.de aeuii at posteo.de
Tue Nov 3 05:54:46 EST 2015


Hi,

I'm using

    fig, axes = plt.subplots(nrows=2, ncols=3)

to generate a figure and later in code I would like to find out how many
columns and rows of are in the layout having only Figure object (fig).

I was not able to find those parameters stored in `fig`.  I noticed that
fig.axes or fig.get_axes() return a flattened list of all axes, but
without structure (like `axes` from `plt.subplots`).  What's the best
way to find out `nrows` and `ncols` from `fig`?

Thanks in advance!

Please CC me, because I'm not subscribed to the list.

Best regards,
Stefan


More information about the Matplotlib-users mailing list