Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple figure arrangement using Matplotlib

Can we control where Matplotlib places figures on the screen?

I want to generate four figures (in four separate windows) that do not overlap.

like image 587
David Avatar asked Nov 05 '09 00:11

David


People also ask

How do I plot multiple figures in Python matplotlib?

In Matplotlib, we can draw multiple graphs in a single plot in two ways. One is by using subplot() function and other by superimposition of second graph on the first i.e, all graphs will appear on the same plot.

How do I display multiple images in one figure correctly in matplotlib?

The easiest way to display multiple images in one figure is use figure(), add_subplot(), and imshow() methods of Matplotlib. The approach which is used to follow is first initiating fig object by calling fig=plt. figure() and then add an axes object to the fig by calling add_subplot() method.


1 Answers

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.

like image 82
Evan Avatar answered Oct 04 '22 21:10

Evan