Re: Plot not showing up in Jupyter.
[email protected] Wed, 24 Feb 2016 16:05:10 -0500
| Newsgroups | gmane.comp.python.ipython.user |
|---|---|
| Message-ID | <[email protected]> |
--===============6786407791305382853== Content-Type: multipart/alternative; boundary="----=_Part_18928_1523314975.1456347909978" ------=_Part_18928_1523314975.1456347909978 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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 <[email protected]> To: ipython-user <[email protected]> Sent: Wed, Feb 24, 2016 4:00 am Subject: IPython-User Digest, Vol 147, Issue 2 Send IPython-User mailing list submissions to [email protected] 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 [email protected] You can reach the person managing the list at [email protected] 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 <[email protected]> To: "Discussions about using IPython. http://ipython.org" <[email protected]> Subject: Re: [IPython-User] Plot not showing up in Jupyter. Message-ID: <CAOUkfAyswdcsbdM+jkz0e3Eqbb6HeqyYhcrDoGotJ807O8PgzQ@mail.gmail.com> 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, <[email protected]> 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 > [email protected] > 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 [email protected] https://mail.scipy.org/mailman/listinfo/ipython-user ------------------------------ End of IPython-User Digest, Vol 147, Issue 2 ******************************************** ------=_Part_18928_1523314975.1456347909978 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit <font color='black' size='2' face='arial'> <div> <br> </div> <font size="2">Thank you William, <br> <br> Both of your suggestions worked. I wonder why the author didn't include this, or is this command relative to Jupyter and not the </font>IP[y]: Notebook version<font size="2">?<br> 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 :) <br> <br> Thanks again,<br> Ana<br> </font> <div> <br> </div> <div> <br> </div> <div> <br> </div> <div style="font-family:arial,helvetica;font-size:10pt;color:black">-----Original Message-----<br> From: ipython-user-request <[email protected]><br> To: ipython-user <[email protected]><br> Sent: Wed, Feb 24, 2016 4:00 am<br> Subject: IPython-User Digest, Vol 147, Issue 2<br> <br> Send IPython-User mailing list submissions to<br> <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a><br> <br> To subscribe or unsubscribe via the World Wide Web, visit<br> <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="https://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-user</a><br> or, via email, send a message with subject or body 'help' to<br> <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a><br> <br> You can reach the person managing the list at<br> <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a><br> <br> When replying, please edit your Subject line so it is more specific<br> than "Re: Contents of IPython-User digest..."<br> <br> <br> Today's Topics:<br> <br> 1. Re: Plot not showing up in Jupyter. (William Shipman)<br> <br> <br> ----------------------------------------------------------------------<br> <br> Message: 1<br> Date: Tue, 23 Feb 2016 20:52:40 +0200<br> From: William Shipman <<a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a>><br> To: "Discussions about using IPython. <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="http://ipython.org" target="_blank">http://ipython.org</a>"<br> <<a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a>><br> Subject: Re: [IPython-User] Plot not showing up in Jupyter.<br> Message-ID:<br> <<a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:CAOUkfAyswdcsbdM+jkz0e3Eqbb6HeqyYhcrDoGotJ807O8PgzQ@mail.gmail.com">CAOUkfAyswdcsbdM+jkz0e3Eqbb6HeqyYhcrDoGotJ807O8PgzQ@mail.gmail.com</a>><br> Content-Type: text/plain; charset="utf-8"<br> <br> You need to add<br> <br> %matplotlib inline<br> <br> before you want to draw your plots, e.g. at the start of your<br> notebook. Alternatively call plt.show() but that will open separate<br> figure windows rather than showing the figures in the notebook.<br> <br> <br> On 23 February 2016 at 20:30, <<a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a>> wrote:<br> <br> > Hello,<br> > I?m new to Jupyter and am also learning python and pandas for data<br> > analysis.<br> > The version of the notebook server is *4.0.6* and is running on:<br> > Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 21 2015, 19:35:23)<br> > [MSC v.1500 64 bit (AMD64)]<br> ><br> > I'm working on a Win/7 64bit pro system.<br> ><br> > Currently I?m watching Alfred Essa?s video series and am having an issue<br> > with Jupyter in regards to one of the lessons. (<br> > <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="https://www.youtube.com/watch?v=rNmn8bLFgdg" target="_blank">https://www.youtube.com/watch?v=rNmn8bLFgdg</a>)<br> > <<a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="https://www.youtube.com/watch?v=rNmn8bLFgdg" target="_blank">https://www.youtube.com/watch?v=rNmn8bLFgdg</a>><br> > I?m not sure how much of the code I need to submit, but basically I?ve<br> > created a subset of salary data, from which I extract the top 10 payees. I?ve<br> > imported pandas as pd and matplotlib.pyplot as plt into the notebook.<br> > Everything is working fine and I?ve been able to verify my data. My last<br> > bit of code is:<br> ><br> > *#create a data set of the top 10 paid players*<br> > top10 = yr2010.Salary.sort_values(ascending =False).head(10)<br> ><br> > This creates a series object of the data and then I tried to plot it and<br> > that?s where the problem lies.<br> > Here?s my code to plot:<br> ><br> > #plot highest paid<br> > plt.figure()<br> > top10.plot(label='Salaries')<br> > plt.xticks(rotation='vertical')<br> > plt.legend()<br> ><br> > and the output is this:<br> > <matplotlib.legend.Legend at 0xbff72e8><br> ><br> > No plot image.<br> ><br> > Note: I have copied all of my code and run it successfully, producing<br> > the plotted image in both IDLE and the Spyder IDE.<br> ><br> > The video series is a few years old and I?m wondering if there is a<br> > difference between Jupyter and IP[y]: Notebook versions that may require a<br> > code change in order for the plot to show up. The videos show the Mr.<br> > Essa using<br> > IP[y]: Notebook.<br> ><br> > Thanks and I look forward to any assistance.<br> > Ana<br> ><br> > _______________________________________________<br> > IPython-User mailing list<br> > <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a><br> > <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="https://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-user</a><br> ><br> ><br> -------------- next part --------------<br> An HTML attachment was scrubbed...<br> URL: <<a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="https://mail.scipy.org/pipermail/ipython-user/attachments/20160223/ca19107d/attachment-0001.html" target="_blank">https://mail.scipy.org/pipermail/ipython-user/attachments/20160223/ca19107d/attachment-0001.html</a>><br> <br> ------------------------------<br> <br> Subject: Digest Footer<br> <br> _______________________________________________<br> IPython-User mailing list<br> <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="mailto:[email protected]">[email protected]</a><br> <a removedlink__51f50562-f2e6-415e-b55a-71565539c0b1__href="https://mail.scipy.org/mailman/listinfo/ipython-user" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-user</a><br> <br> <br> ------------------------------<br> <br> End of IPython-User Digest, Vol 147, Issue 2<br> ********************************************<br> </div> </font> ------=_Part_18928_1523314975.1456347909978-- --===============6786407791305382853== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ IPython-User mailing list [email protected] https://mail.scipy.org/mailman/listinfo/ipython-user --===============6786407791305382853==--