Mohammad ElNesr Mohammad ElNesr - 2 years ago 189
Python Question

Tabbed window for matplotlib figures, is it possible?

I have a python project that outputs several Matplotlib figures; each figure contains several charts. The problem that project launches about 15 figures (windows) every run, which I can not reduce.

Is it possible to concatenate all these figures (windows) to a single tabbed window so that each tab represents one figure?

Any help is much appreciated.

Thanks in advance


Thanks to @mobiusklein comments below he suggested a workaround, to export the figures as myltipage pdf file as shown here.

Important note about the multipage pdf example mentioned above.

I tried it, but I got an error regarding the LaTeX use in matplotlib. Because fixing this error is beyond the scope of this question, so I suggest if it occurs to anyone, to set
plt.rc('text', usetex=False)
instead of

I still hope if someone have other solution or workaround to post it for the benefit of others.

Answer Source

The backend you choose to use for matplotlib controls how each figure is displayed. Some backends just render figures to file, while others like the tk, qt, or gtk backends render figures in graphical windows. Those backends determine what functionality those GUI windows have.

The existing backends don't support the type of tabbed navigation you're looking for. Someone else here implemented this using Qt4.

You might also try writing your own report files with PDF or HTML which would let you more easily write more complex image arrangements with simpler libraries.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download