12

i am trying to display a plot but in fullscreen. This is my code :

import numpy as np
import pylab as plt
a = np.array([1,2,3,4])
b = np.array([1,2,3,4])
plt.plot(a,b,'.')
plt.show()

But the problem is : this does not display with the fullscreen. Any ideas to solve this ? Thank you.

Kenneth Metzger
  • 133
  • 1
  • 1
  • 4
  • what do you mean by full screen? – kmario23 Feb 20 '17 at 21:56
  • Possible duplicate of [Saving Matplotlib graphs to image as full screen](http://stackoverflow.com/questions/32428193/saving-matplotlib-graphs-to-image-as-full-screen) – Marat Feb 21 '17 at 03:26

3 Answers3

16

The code provided in the accepted answer will maximize the figure, but won't display it in fullscreen mode.

If you are keeping a reference to the figure, this is how you can toggle fullscreen mode:

import matplotlib.pyplot as plt

fig = plt.figure()
fig.canvas.manager.full_screen_toggle() # toggle fullscreen mode
fig.show()

alternatively, if you're not keeping a reference:

import matplotlib.pyplot as plt

plt.figure()
plt.get_current_fig_manager().full_screen_toggle() # toggle fullscreen mode
plt.show()

To toggle fullscreen mode using your keyboard, simply press f or Ctrl+f.

Tairone
  • 190
  • 1
  • 8
5

It is depend on your matplotlib backend. For Qt you may write this codeto maximize your plotting window:

manager = plt.get_current_fig_manager()
manager.window.showMaximized()

And read this question: Saving Matplotlib graphs to image as full screen

Serenity
  • 35,289
  • 20
  • 120
  • 115
1

If you also want to remove tool and status bar, with the full_screen_toggle mode you can prove:

fig, ax = plt.subplots() 
plt.rcParams['toolbar'] = 'None' # Remove tool bar (upper)
fig.canvas.window().statusBar().setVisible(False) # Remove status bar (bottom)

manager = plt.get_current_fig_manager()
manager.full_screen_toggle()

Taken from http://matplotlib.1069221.n5.nabble.com/Image-full-screen-td47276.html

Jhacson
  • 21
  • 1