<div dir="ltr"><div><div><div><div>Wow, it is a bit convoluted. It looks like you can't get this information directly from the figure object because it is never stored in the figure. It is stored in the individual axes objects (go figure!). Furthermore, you would need to watch out for the use of fig.get_axes() because other axes may be added, such as colorbar axes and such, that were never a part of the original set of axes.<br><br></div>To get the nrows/ncols from an Axes object:<br></div>nrows, ncols, _, _ = ax.get_subplotspec().get_geometry()<br><br></div>I hope that helps!<br></div>Ben Root<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 5:54 AM,  <span dir="ltr"><<a href="mailto:aeuii@posteo.de" target="_blank">aeuii@posteo.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm using<br>
<br>
    fig, axes = plt.subplots(nrows=2, ncols=3)<br>
<br>
to generate a figure and later in code I would like to find out how many<br>
columns and rows of are in the layout having only Figure object (fig).<br>
<br>
I was not able to find those parameters stored in `fig`.  I noticed that<br>
fig.axes or fig.get_axes() return a flattened list of all axes, but<br>
without structure (like `axes` from `plt.subplots`).  What's the best<br>
way to find out `nrows` and `ncols` from `fig`?<br>
<br>
Thanks in advance!<br>
<br>
Please CC me, because I'm not subscribed to the list.<br>
<br>
Best regards,<br>
Stefan<br>
_______________________________________________<br>
Matplotlib-users mailing list<br>
<a href="mailto:Matplotlib-users@python.org">Matplotlib-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-users" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-users</a><br>
</blockquote></div><br></div>