I am working on figures for my thesis, which consist of several related panels. Each of the panel contains several subplots. In order to arrange the plots I would like to split the figure into two (or more) panels and within each of them create a nested set of subplots. Optimally, the main panels should define their own coordinate systems, such that all of the nested subplot positions are defined within their frame. The syntax could look like that:
panel1 = subplot(1,2,1)
panel2 = subplot(1,2,2)
ax1 = panel1.add_subplot(1,2,1)
ax2 = panel1.add_subplot(1,2,2)
ax3 = panel2.add_subplot(111)
For now it is not possible, because panel1 and panel2 are Axes instances which do not have add_subplot method. The only solution I am aware of is to define all of the subplots by hand using subplot or axes function with positions defined within whole figure coordinate system:
fig = figure()
ax1 = fig.add_subplot(2,2,1)
ax2 = fig.add_subplot(2,2,3)
ax3 = fig.add_subplot(1,2,2)
This is of course more difficult, less flexible and requires the user to decide in advance on the layout of the panel.
Until now I exported each figure to SVG file and arranged them in one file using SVG directives. I also started implementing my own Multipanel class for matplotlib, but it proved out to be not so easy. Therefore I would like to ask if someone has implemented a similar approach or could give me some hints on the implementation.
I will be very grateful for any help.