I am trying to show some plots using plt.show (). i get the plots shown on the IPython console, but I need to see each figure in a new window. What can I do ?
Asked
Active
Viewed 1.7k times
4
-
Please clarify. Do you want all the windows containing the plots open at the same time? Or do you just want each plot in a window rather than in the IPython console? – Rory Daulton Apr 17 '17 at 09:48
-
I want to see each plot an a seperate window, not in the IPython console. – ufdul Apr 17 '17 at 09:50
-
because I need to save them later on using figures=[manager.canvas.figure for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers()] I need all the figures to be open each plot in a seperate figure window – ufdul Apr 17 '17 at 09:52
3 Answers
5
In your notebook, try
import matplotlib.pyplot as plt
%matplotlib
Called alone like this, it should give output in a separate window. There are also several options to %matplotlib depending on your system. To see all options available to you, use
%matplotlib -l
Calling
%matplotlib inline
will draw the plots in the notebook again.

pgrenholm
- 787
- 6
- 7
4
You want to type %matplotlib qt
into your iPython console. This changes it for the session you're in only. To change it for the future, go Tools > Preferences
, select iPython Console > Graphics
, then set Graphics Backend
to Qt4
or Qt5
. This ought to work.

Seabody
- 1,197
- 1
- 12
- 27
1
Other option is using plt.figure:
import matplotlib.pyplot as plt
plt.figure(1) # the first figure
plt.subplot(211) # the first subplot in the first figure
plt.plot([1, 2, 3])
plt.subplot(212) # the second subplot in the first figure
plt.plot([4, 5, 6])
plt.show(block=False)
plt.figure(2) # a second figure
plt.plot([4, 5, 6]) # creates a subplot(111) by default
plt.show(block=False)
plt.figure(1) # figure 1 current; subplot(212) still current
plt.subplot(211) # make subplot(211) in figure1 current
plt.title('Easy as 1, 2, 3') # subplot 211 title
plt.show(block=False)

paloma
- 13
- 1
- 5