Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get interactive plots again in Spyder/IPython/matplotlib?

I upgraded from Python(x,y) 2.7.2.3 to 2.7.6.0 in Windows 7 (and was happy to see that I can finally type function_name? and see the docstring in the Object Inspector again) but now the plotting doesn't work as it used to.

Previously (Spyder 2.1.9, IPython 0.10.2, matplotlib 1.2.1), when I plotted this script, for instance, it would plot the subplots side-by-side in an interactive window:

enter image description here

Now (Spyder 2.2.5, IPython 1.2.0, Matplotlib 1.3.1) when I try to plot things, it does the subplots as tiny inline PNGs, which is a change in IPython:

tiny inline PNGs

So I went into options and found this:

graphics options

which seems to say that I can get the old interactive plots back, with the 4 subplots displayed side-by-side, but when I switch to "Automatic", and try to plot something, it does nothing. No plots at all.

If I switch this drop-down to Qt, or uncheck "Activate support", it only plots the first subplot, or part of it, and then stops:

enter image description here

How do I get the old behavior of 4 side-by-side subplots in a single figure that I can interact with?

like image 215
endolith Avatar asked May 10 '14 19:05

endolith


People also ask

Why plot is not showing in Spyder?

To make them also appear inline in the Console, uncheck "Mute Inline Plotting" under the Plots pane options menu. One should also verify if the "Plots" pane is visible. Go to View -> Panes and check the "Plots" case.

What is interactive mode in matplotlib?

Matplotlib can be used in an interactive or non-interactive modes. In the interactive mode, the graph display gets updated after each statement. In the non-interactive mode, the graph does not get displayed until explicitly asked to do so.


1 Answers

Change the backend to automatic:

Tools > preferences > IPython console > Graphics > Graphics backend > Backend: Automatic

Then close and open Spyder.

like image 192
Victor Arellano Avatar answered Oct 07 '22 00:10

Victor Arellano