user1639133
user1639133

Reputation: 63

Unable to create plot in external window in Canopy IPython Notebook

I just started using Canopy, and it's very nice, but I am unable to create a figure in an external window in iPython Notebook. I would expect

plot(rand(100))

in the notebook to create a new window, as it does when I use the HTML version launched with "ipython notebook --pylab", but the figure is instead inlined when created in Canopy. The same command in the qtconsole in Canopy does create the figure in a new window as I would like it to. Looking through the Canopy/IPython source code for appearances of 'inline' and 'pylab', inlined figures appear to be hard-coded somehow (the comments mention something about compatibility).

Is there is a way around this, where I can still create figures in new windows from the IPython notebook? The inlined figures are unsatisfactory for my work.

Upvotes: 3

Views: 4568

Answers (2)

punchagan
punchagan

Reputation: 5846

The preference option only changes the pylab backend for the embedded Python pane. To change the backend for a notebook, you will have to do it manually for each notebook, by evaluating:

%pylab qt

Due to a possible issue in matplotlib, if this fails with the error saying matplotlib is not installed, you need to set QT_API=pyside in your environment.

I'm not sure what your operating system is, so, an all platform solution would be, running something like inside your notebook:

import os
os.environ['QT_API'] = 'pyside'
%pylab qt

Upvotes: 2

Alexander Van Atta
Alexander Van Atta

Reputation: 890

Go to Edit --> Preferences --> Python and select a diffrent PyLab backend

Upvotes: 0

Related Questions