Interactive Spyder and Jupyter Matplotlib plots in separate window

Related: Upgrade Spyder, including beta versions


IPython console in Spyder IDE by default opens non-interactive Matplotlib plots in the same inline “notebook”.

Fix

To open up separate windows for interactive figures in Spyder go to Spyder menu and set:

Tools → Preferences → Ipython Console → Graphics → Graphics Backend → Backend: “automatic”

Popout interactive figures are much more useful in general because one can

  • probe the figure data
  • zoom/pan the figure

unlike the static PNGs in the inline Jupyter notebook.

Jupyter notebook

Jupyter notebooks can also have interactive plots. Instead of static inline notebook plots with

%matplotlib inline

for inline interactive plots in Jupyter:

%matplotlib notebook

Example code as below produces an interactive inline plot:

%matplotlib notebook

from matplotlib.pyplot import figure

ax = figure().gca()
ax.plot(range(5))

Tags: , ,

Categories:

Written by Michael Hirsch, Ph.D. //

Comments