Create a figure of figures with matplotlib

1.4k Views Asked by At

I would like to know if there is a way to combined several figures created with matplotlib in one unique figure.

Most of the existing topics are related to multiple plots within one figure. But here, I have several functions which all create one elaborated figure (not just a plot, the figure itself is a multiple plot with texts, title, legends,...)

So instead of just doing the layout of those several figures using a software like Word, is there a way to directly combined all my figures in one unique figure under python ?

Thank you in advance !

2

There are 2 best solutions below

1
ImportanceOfBeingErnest On

The concept of figure in matplotlib does not allow to have a figure inside a figure. The figure is the canvas for other artists, like axes. You may of course add as many axes to a figure as you like. So for example instead of one figure with 4 axes and another figure with 6 axes, you can create a figure with 10 axes.

A good choice may be to use the gridspec, as detailed on the respecive matplotlib page.

0
Esculape On

After additional researches, it seems my problem has no easy solution within Matplotlib itself. Multiple figures layout needs external post-processing of plots.

For those having the same problem, here is an interesting link : Publication-quality figures with matplotlib and svgutils