views:

255

answers:

3

Can we control where matplotlib places figures on the screen? I want to generate four figures (in four separate windows) that do not overlap.

Thanks.

A: 

Not using show() and matplotlib alone. The simplest solution may be to use savefig(..) and use your favorite OS image viewer. If you need interactivity with the plots, matplotlib offers backends

bpowah
A: 

The easiest way I know to do this is to make the window for the figure in your prefered GUI application, and then put the matplotlib figure into this window. There are a bunch of examples of how to do this embedding using different GUI frameworks here.

The code samples can look a bit complicated, but it's mostly boilerplate where you'll only need to modify a few lines.

tom10
+4  A: 

From IPython you can do the following:

figure()
get_current_fig_manager().window.wm_geometry("400x600+20+40")

or equivalently in a python script:

import pylab as pl
pl.figure()
pl.get_current_fig_manager().window.wm_geometry("400x600+20+40")
pl.show()

Note that this assumes you're using the TkAgg backend.

Evan
This is exactly what I needed. Thanks. I added the following two lines in front of your script to get it working a Mac: >>>import matplotlib; >>>matplotlib.use('TkAgg')
David
+1: great to know about (and better than my suggestion).
tom10
If it's the right answer for you, please mark it accepted.
Jouni K. Seppänen