Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plt.show () does not open a new figure window

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 ?

like image 610
ufdul Avatar asked Jan 05 '23 04:01

ufdul


2 Answers

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.

like image 183
pgrenholm Avatar answered Jan 12 '23 10:01

pgrenholm


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.

like image 27
Seabody Avatar answered Jan 12 '23 12:01

Seabody