Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Getting ipython notebook to plot inline (http://www.velocityreviews.com/forums/t953203-getting-ipython-notebook-to-plot-inline.html)

Frank Franklin 10-09-2012 06:02 PM

Getting ipython notebook to plot inline
 
I've just managed to install ipython and get it to run by typing ipython notebook --pylab=inline

Now I'm getting the following error when I try to plot something in ipythonnotebook:
AttributeError: 'module' object has no attribute 'FigureCanvas'

I've tried using imports to make this work:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)

But for some reason I still get this error. Anybody else know what's going on here? All of the print statements I've done before have worked, and I actually got my plots to work when I didn't set --pylab=inline, though theycame up in a separate window and I want them to stay in the ipython notebook.

Frank Franklin 10-11-2012 02:45 PM

Re: Getting ipython notebook to plot inline [updated]
 
Ok, so just to add to this, there is no problem plotting when I used the following command in my terminal to start the notebook:
ipython notebook
The only problem is that this plots my figures outside of the notebook page, and I really want to get everything into the notebook, since that's the point of the install.

but for some reason when I add the --pylab=inline that all the tutorials mention I get the AttributeError I mentioned before. I'm starting to wonderif this is a problem with my machine setup, if I'm missing something else that ipython notebook needs to do inline plotting.

Any help on this would be appreciated -- at this point I'm banging my head against the wall and solution doesn't seem to have surfaced through googling.




On Tuesday, October 9, 2012 2:02:17 PM UTC-4, Frank Franklin wrote:
> I've just managed to install ipython and get it to run by typing ipython notebook --pylab=inline
>
>
>
> Now I'm getting the following error when I try to plot something in ipython notebook:
>
> AttributeError: 'module' object has no attribute 'FigureCanvas'
>
>
>
> I've tried using imports to make this work:
>
> import matplotlib.pyplot as plt
>
> import numpy as np
>
> x = np.arange(0, 5, 0.1);
>
> y = np.sin(x)
>
> plt.plot(x, y)
>
>
>
> But for some reason I still get this error. Anybody else know what's going on here? All of the print statements I've done before have worked, and I actually got my plots to work when I didn't set --pylab=inline, though they came up in a separate window and I want them to stay in the ipython notebook.



All times are GMT. The time now is 10:47 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.