Mis a jour le 2025-04-14, 12:10

Divers

Positionnement sur l'écran de la fenêtre affichée par pyplot.show()

Cela dépend du backend utilisé (et qui doit être installé) :
  • avec Tk :
    import matplotlib
    matplotlib.use('TkAgg')
    from matplotlib import pyplot
    pyplot.figure()
    pyplot.plot([1, 2, 3, 7, 8, 9])
    pyplot.get_current_fig_manager().window.wm_geometry("800x800+0+0")
    pyplot.show()
        
  • avec Qt :
    import matplotlib
    matplotlib.use('Qt4Agg')
    from matplotlib import pyplot
    pyplot.figure()
    pyplot.plot([1, 2, 3, 7, 8, 9])
    pyplot.get_current_fig_manager().window.setGeometry(0, 0, 800, 800)
    pyplot.show()
        
  • avec Wx :
    import matplotlib
    matplotlib.use('wx')
    from matplotlib import pyplot
    pyplot.figure()
    pyplot.plot([1, 2, 3, 7, 8, 9])
    pyplot.get_current_fig_manager().window.SetPosition((0, 0))
    pyplot.show()
        

Copyright python-simple.com
programmer en python, tutoriel python, graphes en python, Aymeric Duclert