I use the Tk library for plotting, you can set this up by default in the ~/.matplotlib/matplotlibrc
file by writing:
backend : TkAgg
This allows me to set the window position and dimensions using:
import matplotlib.pyplot as plot
wm = plot.get_current_fig_manager()
wm.window.wm_geometry("800x900+50+50")
As someone might be wanting to position their matplotlib window on a Mac I wanted to make a quick contribution. I frequently work with and without an external screen (at work and at home) and wanted some way of automatically using the external screen if it is available. Luckily must of the Mac operating system can be interfaced through AppKit.
The following snippet will return a list of ScreenInfo objects with position, width and height:
from AppKit import NSScreen
class ScreenInfo:
pass
def getScreensInfo():
screens = []
for i, s in enumerate(NSScreen.screens()):
screen = ScreenInfo()
frame = s.frame()
screen.x = frame.origin.x
screen.y = frame.origin.y
screen.w = frame.size.width
screen.h = frame.size.height
screens.append(screen)
return screens