Quantcast

[IPython-User] Plot not showing up in Jupyter.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[IPython-User] Plot not showing up in Jupyter.

starigazey
Hello,
I’m new to Jupyter and am also learning python and pandas for data analysis.
The version of the notebook server is 4.0.6 and is running on:
Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 21 2015, 19:35:23) [MSC v.1500 64 bit (AMD64)]

I'm working on a Win/7 64bit pro system.
 
Currently I’m watching Alfred Essa’s video series and am having an issue with Jupyter in regards to one of the lessons.  (https://www.youtube.com/watch?v=rNmn8bLFgdg)
I’m not sure how much of the code I need to submit, but basically I’ve created a subset of salary data, from which I extract the top 10 payees.  I’ve imported pandas as pd and matplotlib.pyplot as plt into the notebook. Everything is working fine and I’ve been able to verify my data. My last bit of code is:

#create a data set of the top 10 paid players
top10 = yr2010.Salary.sort_values(ascending =False).head(10)
 
This creates a series object of the data and then I tried to plot it and that’s where the problem lies.
Here’s my code to plot:

#plot highest paid
plt.figure()
top10.plot(label='Salaries')
plt.xticks(rotation='vertical')
plt.legend()
 
and the output is this:
<matplotlib.legend.Legend at 0xbff72e8>
 
No plot image.
 
Note:  I have copied all of my code and run it successfully, producing the plotted image in both IDLE and the Spyder IDE.
 
The video series is a few years old and I’m wondering if there is a difference between Jupyter and IP[y]: Notebook versions that may require a code change in order for the plot to show up. The videos show the Mr. Essa using
IP[y]: Notebook.
 
Thanks and I look forward to any assistance.
Ana

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plot not showing up in Jupyter.

William Shipman
You need to add
%matplotlib inline

before you want to draw your plots, e.g. at the start of your notebook. Alternatively call plt.show() but that will open separate figure windows rather than showing the figures in the notebook.

On 23 February 2016 at 20:30, <[hidden email]> wrote:
Hello,
I’m new to Jupyter and am also learning python and pandas for data analysis.
The version of the notebook server is 4.0.6 and is running on:
Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 21 2015, 19:35:23) [MSC v.1500 64 bit (AMD64)]

I'm working on a Win/7 64bit pro system.
 
Currently I’m watching Alfred Essa’s video series and am having an issue with Jupyter in regards to one of the lessons.  (https://www.youtube.com/watch?v=rNmn8bLFgdg)
I’m not sure how much of the code I need to submit, but basically I’ve created a subset of salary data, from which I extract the top 10 payees.  I’ve imported pandas as pd and matplotlib.pyplot as plt into the notebook. Everything is working fine and I’ve been able to verify my data. My last bit of code is:

#create a data set of the top 10 paid players
top10 = yr2010.Salary.sort_values(ascending =False).head(10)
 
This creates a series object of the data and then I tried to plot it and that’s where the problem lies.
Here’s my code to plot:

#plot highest paid
plt.figure()
top10.plot(label='Salaries')
plt.xticks(rotation='vertical')
plt.legend()
 
and the output is this:
<matplotlib.legend.Legend at 0xbff72e8>
 
No plot image.
 
Note:  I have copied all of my code and run it successfully, producing the plotted image in both IDLE and the Spyder IDE.
 
The video series is a few years old and I’m wondering if there is a difference between Jupyter and IP[y]: Notebook versions that may require a code change in order for the plot to show up. The videos show the Mr. Essa using
IP[y]: Notebook.
 
Thanks and I look forward to any assistance.
Ana

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user



_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plot not showing up in Jupyter.

starigazey

Thank you William,

Both of your suggestions worked.  I wonder why the author didn't include this, or is this command relative to Jupyter and not the 
IP[y]: Notebook version?
I looked at his notebook and it doesn't appear yet the image shows up as a result of the plt.figure()method....OK I just googled this and found that you can configure Jupyter to make matplotlib inline by default, so his notebook must have been configured this was :)  

Thanks again,
Ana



-----Original Message-----
From: ipython-user-request <[hidden email]>
To: ipython-user <[hidden email]>
Sent: Wed, Feb 24, 2016 4:00 am
Subject: IPython-User Digest, Vol 147, Issue 2

Send IPython-User mailing list submissions to
[hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
https://mail.scipy.org/mailman/listinfo/ipython-user
or, via email, send a message with subject or body 'help' to
[hidden email]

You can reach the person managing the list at
[hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of IPython-User digest..."


Today's Topics:

1. Re: Plot not showing up in Jupyter. (William Shipman)


----------------------------------------------------------------------

Message: 1
Date: Tue, 23 Feb 2016 20:52:40 +0200
From: William Shipman <[hidden email]>
To: "Discussions about using IPython. http://ipython.org"
<[hidden email]>
Subject: Re: [IPython-User] Plot not showing up in Jupyter.
Message-ID:
<[hidden email]>
Content-Type: text/plain; charset="utf-8"

You need to add

%matplotlib inline

before you want to draw your plots, e.g. at the start of your
notebook. Alternatively call plt.show() but that will open separate
figure windows rather than showing the figures in the notebook.


On 23 February 2016 at 20:30, <[hidden email]> wrote:

> Hello,
> I?m new to Jupyter and am also learning python and pandas for data
> analysis.
> The version of the notebook server is *4.0.6* and is running on:
> Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 21 2015, 19:35:23)
> [MSC v.1500 64 bit (AMD64)]
>
> I'm working on a Win/7 64bit pro system.
>
> Currently I?m watching Alfred Essa?s video series and am having an issue
> with Jupyter in regards to one of the lessons. (
> https://www.youtube.com/watch?v=rNmn8bLFgdg)
> <https://www.youtube.com/watch?v=rNmn8bLFgdg>
> I?m not sure how much of the code I need to submit, but basically I?ve
> created a subset of salary data, from which I extract the top 10 payees. I?ve
> imported pandas as pd and matplotlib.pyplot as plt into the notebook.
> Everything is working fine and I?ve been able to verify my data. My last
> bit of code is:
>
> *#create a data set of the top 10 paid players*
> top10 = yr2010.Salary.sort_values(ascending =False).head(10)
>
> This creates a series object of the data and then I tried to plot it and
> that?s where the problem lies.
> Here?s my code to plot:
>
> #plot highest paid
> plt.figure()
> top10.plot(label='Salaries')
> plt.xticks(rotation='vertical')
> plt.legend()
>
> and the output is this:
> <matplotlib.legend.Legend at 0xbff72e8>
>
> No plot image.
>
> Note: I have copied all of my code and run it successfully, producing
> the plotted image in both IDLE and the Spyder IDE.
>
> The video series is a few years old and I?m wondering if there is a
> difference between Jupyter and IP[y]: Notebook versions that may require a
> code change in order for the plot to show up. The videos show the Mr.
> Essa using
> IP[y]: Notebook.
>
> Thanks and I look forward to any assistance.
> Ana
>
> _______________________________________________
> IPython-User mailing list
> [hidden email]
> https://mail.scipy.org/mailman/listinfo/ipython-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.scipy.org/pipermail/ipython-user/attachments/20160223/ca19107d/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user


------------------------------

End of IPython-User Digest, Vol 147, Issue 2
********************************************

_______________________________________________
IPython-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/ipython-user
Loading...