Setting the absolute position of a figure using python matplotlib with the MacOSX backend -
is possible set absolute position of figure on screen using matplotlib macosx backend?
this answer
how set absolute position of figure windows matplotlib?
says can done other backends, doesn't mention how macosx backend.
with macosx backend there no way set window position of matplotlib window. under macosx speaking can use other matplotlib backends allow this. tkagg backend (using tcl/tk via tkinter binding in python standard library) should installed automatically.
in python script, before else, switch backend, create plot, show , can move window with
get_current_fig_manager().window.wm_geometry("+<x-pos>+<y-pos>") here working example:
import matplotlib matplotlib.use("tkagg") # set backend import matplotlib.pyplot plt plt.figure() plt.plot([0,1,2,0,1,2]) # draw plt.show(block=false) plt.get_current_fig_manager().window.wm_geometry("+600+400") # move window if install imho nicer qt4 gui framework pyqt bindings, position window with
get_current_fig_manager().window.setgeometry(<x-pos>,<x-pos>,<width>,<height>) again full example:
import matplotlib matplotlib.use("qt4agg") # set backend import matplotlib.pyplot plt plt.figure() plt.plot([0,1,2,0,1,2]) # draw plt.show(block=false) plt.get_current_fig_manager().window.setgeometry(600,400,1000,800)
Comments
Post a Comment