Getting ipython notebook to plot inline

Discussion in 'Python' started by Frank Franklin, Oct 9, 2012.

  1. 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, Oct 9, 2012
    #1
    1. Advertising

  2. 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.
    Frank Franklin, Oct 11, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhi
    Replies:
    2
    Views:
    734
    E. Robert Tisdale
    Jul 3, 2003
  2. Dr. Colombes
    Replies:
    1
    Views:
    1,031
    John Hunter
    Feb 10, 2005
  3. bdb112
    Replies:
    2
    Views:
    1,168
    Jason Scheirer
    Mar 12, 2009
  4. Wolfram Brenig

    ipython -wthread vs. ipython -pylab

    Wolfram Brenig, Sep 12, 2011, in forum: Python
    Replies:
    0
    Views:
    338
    Wolfram Brenig
    Sep 12, 2011
  5. Anoop Thomas Mathew
    Replies:
    0
    Views:
    112
    Anoop Thomas Mathew
    Nov 9, 2013
Loading...

Share This Page