22 Dec 2017

Maxmise plot in matplotlib

收藏到CSDN网摘

To make the plot maxmised, different commands need to be used according to the current backends used by matplotlib:

def max_fig():
   ''' maxmize the figure depend on the backend, works on all OSes '''
   backend = plt.get_backend().lower()
   fig_man = plt.get_current_fig_manager()
   if 'tk' in backend: # TkAgg
      fig_man.window.state('zoomed')
   elif 'wx' in backend: # WxAgg
      fig_man.frame.Maximize(True)
   elif 'qt' in backend: # QtAgg
      fig_man.window.showMaximized()

No comments :

Post a Comment