Control the position of a figure window

Hi,

Is it possible to specify the position of a figure window when one is created? This will be a killing feature if one wants to put the figure window at the right place in the screen automatically. It is annoying if ones has to drag a new figure to a comfortable place in the screen every time a new figure is created.

Jianbao

Jianbao,

This question has come up before, and I have never really felt that a good solution was ever given. However, here are some discussions and some solutions for it.

http://stackoverflow.com/questions/7449585/how-do-you-set-the-absolute-position-of-figure-windows-with-matplotlib

http://www.mail-archive.com/matplotlib-users@…1753…forge.net/msg14387.html
http://stackoverflow.com/questions/11336835/ask-window-manager-to-place-matplotlib-plot-windows-always-on-top

I know there are more discussions than this, mostly related to controlling your window manager, but I can’t seem to find them right now.

Cheers!
Ben Root

···

On Tue, Oct 2, 2012 at 11:38 PM, Jianbao Tao <jianbao.tao@…287…> wrote:

Hi,

Is it possible to specify the position of a figure window when one is created? This will be a killing feature if one wants to put the figure window at the right place in the screen automatically. It is annoying if ones has to drag a new figure to a comfortable place in the screen every time a new figure is created.

Jianbao

Ben,

Thanks for your reply. :slight_smile:

This first link you mentioned seems to be a workaround. However, I am wondering if there is a way to set the position before the figure window is realized. Besides, the solution in the first link uses pyplot.get_current_fig_manager(). However, I don’t see a counterpart of the figure manager in the matplotlib classes. From a developer perspective, it would be great if you can control the figure position during the initialization of the figure window, i.e., before there is any current figure window. However, I don’t know if this is too much for now for matplotlib development.

Cheers,

Jianbao

···

On Wed, Oct 3, 2012 at 6:57 AM, Benjamin Root <ben.root@…1304…> wrote:

On Tue, Oct 2, 2012 at 11:38 PM, Jianbao Tao <jianbao.tao@…878…287…> wrote:

Hi,

Is it possible to specify the position of a figure window when one is created? This will be a killing feature if one wants to put the figure window at the right place in the screen automatically. It is annoying if ones has to drag a new figure to a comfortable place in the screen every time a new figure is created.

Jianbao

Jianbao,

This question has come up before, and I have never really felt that a good solution was ever given. However, here are some discussions and some solutions for it.

http://stackoverflow.com/questions/7449585/how-do-you-set-the-absolute-position-of-figure-windows-with-matplotlib

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14387.html
http://stackoverflow.com/questions/11336835/ask-window-manager-to-place-matplotlib-plot-windows-always-on-top

I know there are more discussions than this, mostly related to controlling your window manager, but I can’t seem to find them right now.

Cheers!
Ben Root

I was after a similar issue once, and asked this question at SO:

http://stackoverflow.com/questions/7802366/matplotlib-window-layout-questions

Manual positioning is fine sometimes if I want to really place windows side-by-side for comparison purposes. However it would be nicer if mpl were to remember positions of figures so that it would place the new figures exactly the same place where they were before closed.

Actually, I have similar complaint for other windows opened in my Fedora 16 (Gnome 3.2) system. Say for instance I start a gvim instance, then move its window to my second monitor, but closing and re-opening it, the window’s position is restored to the first monitor. Same thing is for evince, sometimes it opens pdf’s on the first monitor, sometimes on the second, randomly position at least for my observation. I don’t know where to look for a solution; in each specific program, or windows manager should handle / remember positions of windows on screens.

···

On Tue, Oct 2, 2012 at 9:38 PM, Jianbao Tao <jianbao.tao@…287…> wrote:

Hi,

Is it possible to specify the position of a figure window when one is created? This will be a killing feature if one wants to put the figure window at the right place in the screen automatically. It is annoying if ones has to drag a new figure to a comfortable place in the screen every time a new figure is created.

Jianbao


Don’t let slow site performance ruin your business. Deploy New Relic APM

Deploy New Relic app performance management and know exactly

what is happening inside your Ruby, Python, PHP, Java, and .NET app

Try New Relic at no cost today and get our sweet Data Nerd shirt too!

http://p.sf.net/sfu/newrelic-dev2dev


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Gökhan

If you like to use qt4 as backend, you can also do it like this:

import sys
from PySide import QtGui
import numpy as np
from matplotlib.figure import Figure

from matplotlib.backends.backend_qt4agg \
import FigureCanvasQTAgg as FigureCanvas

fig = Figure()
axes = fig.add_subplot(111)
x = np.arange(0.0, 3.0, 0.01)
y = np.cos(2*np.pi*x)
axes.plot(x, y)

# show plot in Qt FigureCanvas
qApp = QtGui.QApplication(sys.argv)
fc=FigureCanvas(fig)
fc.setGeometry(2000, 100, 500, 500)
fc.show()

# a second plot
fc1=FigureCanvas(fig)
fc1.setGeometry(500, 100, 500, 500)
fc1.show()

sys.exit(qApp.exec_())

This works for me on windows with two screens.

Juergen

···

Am 03.10.2012 20:26, schrieb G�khan Sever:

I was after a similar issue once, and asked this question at SO:

python - matplotlib window layout questions - Stack Overflow

Manual positioning is fine sometimes if I want to really place windows
side-by-side for comparison purposes. However it would be nicer if mpl were
to remember positions of figures so that it would place the new figures
exactly the same place where they were before closed.

Actually, I have similar complaint for other windows opened in my Fedora 16
(Gnome 3.2) system. Say for instance I start a gvim instance, then move its
window to my second monitor, but closing and re-opening it, the window's
position is restored to the first monitor. Same thing is for evince,
sometimes it opens pdf's on the first monitor, sometimes on the second,
randomly position at least for my observation. I don't know where to look
for a solution; in each specific program, or windows manager should handle
/ remember positions of windows on screens.

On Tue, Oct 2, 2012 at 9:38 PM, Jianbao Tao <jianbao.tao@...287...> wrote:

Hi,

Is it possible to specify the position of a figure window when one is
created? This will be a killing feature if one wants to put the figure
window at the right place in the screen automatically. It is annoying if
ones has to drag a new figure to a comfortable place in the screen every
time a new figure is created.

Jianbao

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options