14

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.

2

3 Answers 3

20

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Great answer: this instruction is independant of the window manager being used!
to save time) At least in Windows, manager.full_screen_toggle() makes the pop-up window "full-screen mode", which is not the same as a maximized window. The latter can be achieved by different codes depending on the backend: e.g. manager.window.showMaximized() for QtAgg, manager.window.state('zoomed') for TkAgg, and manager.frame.Maximize(True) for wxAgg.
8

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

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.