1

There exists many ways to create grid of plots with Matplotlib (e.g., pyplot.subplots(2, 3)) but as far as I can tell, all of them relies in a procedure where you get the axes form a specific function and then draw in these axes. For example (taken from here):

n = np.random.randn(100000)
fig, axes = plt.subplots(1, 2, figsize=(12,4))

axes[0].hist(n)
axes[0].set_title("Default histogram")
axes[0].set_xlim((min(n), max(n)))

axes[1].hist(n, cumulative=True, bins=50)
axes[1].set_title("Cumulative detailed histogram")
axes[1].set_xlim((min(n), max(n)));

However, let say I have a function which returns a matplotlib.figure.Figure object. I want to call this function N time, get N Figure objects out of it, and then display these Figure objects in a grid... how this can be done?

Christian O'Reilly
  • 1,864
  • 3
  • 18
  • 33
  • In short it doesn't seem to be possible. I would instead return `axes` objects. – Ffisegydd Apr 30 '14 at 20:19
  • @Ffisegydd Yes, clearly a duplicate, sorry. I should have been using the wrong keywords in my search. – Christian O'Reilly Apr 30 '14 at 20:21
  • 1
    http://stackoverflow.com/questions/18284296/matplotlib-using-a-figure-object-to-initialize-a-plot/18302072#18302072 <- might also be useful (sorry for the self promotion) – tacaswell Apr 30 '14 at 21:11

0 Answers0