Python Forum
Why does graph look different in Codecademy and Jupyter Notebook
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does graph look different in Codecademy and Jupyter Notebook
#1
It's part of Codecademy's premium content so I can't post the entire code but in their software I produce a graph that looks like this:

[Image: erB5UHB.jpg]

Whereas in Jupyter Notebooks it looks like this

[Image: OXjLIJd.jpg]

I have copy/pasted the code with the exception of "import codecademylib3_seaborn" which throws up a module error in Jupyter.

The first graph produced in Codecademy's IDE is

[Image: 9gFKnz3.jpg]

and in Jupyter is

[Image: VnTfpZq.jpg]

which are identical bar the y axis numbers - it appears the Codecademy graphs "add on" with new plt.plot - whereas the JupyterNotebook does a new graph each time.

What is the causing the differences, and how do I get the Jupyter graph to look like the one in Codecademy? Thank you!
Reply
#2
(Feb-21-2023, 09:58 AM)abc123456 Wrote: What is the causing the differences, and how do I get the Jupyter graph to look like the one in Codecademy? Thank you!

Hi!

The last two graphics are identical, because both "x" axes go from 1998 to 2012. The same applies to both "y" axes, going from 3600000 (3.6 1e6) to 5000000 (5.0 1e6).

The first two graphics are, on the contrary, different. It seems that the span of values given for the axes are different.

While the "x" axis on the first graphic (Codecacademy) starts on roughly 1998, the "x" axis on the second graphic (Jupyter Notebook) starts on roughly 2012, which is precisely where the dots have stopped to appear on the first graphic. That is why the blue dots are not shown on the second graphic.

Similarly, where the dots have stopped to appear on the "y" axis on the first graphic (Codecacademy), it's precisely the upper limit of the span of the "y" axis on the second graphic (Jupyter Notebook). That is also why the blue dots are not shown on the second graphic.

I would check the span of values given to be represented on both axes on both graphics for the Codecacademy as well as for the Jupyter Notebook.

I hope it helps.
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Jupyter notebooks, jupyter kernels, virtual environment created in Anaconda... bytecrunch 8 2,338 Nov-05-2023, 06:38 PM
Last Post: snippsat
  Jupyter Notebook TypeError Holidays entity loader class bmanning20 0 2,737 Jul-20-2023, 06:52 PM
Last Post: bmanning20
  Setting up and integrating Jupyter Notebook development environment with VSC Drone4four 3 1,902 Sep-12-2022, 09:18 AM
Last Post: Drone4four
Thumbs Up can't access data from URL in pandas/jupyter notebook aaanoushka 1 1,878 Feb-13-2022, 01:19 PM
Last Post: jefsummers
Exclamation Jupyter Notebook - Help Needed! eyadfr 1 1,847 Jan-26-2022, 06:42 PM
Last Post: jefsummers
  Help needed with Jupyter Notebook eyadfr 4 2,130 Jan-04-2022, 08:20 PM
Last Post: snippsat
  HELP! Importing json file into csv into jupyter notebook vilsef 2 2,586 Jan-22-2021, 11:06 AM
Last Post: snippsat
  How can draw a real-time marker on map using folium/leaflet Jupyter notebook C3PO 0 2,426 Dec-22-2020, 07:04 PM
Last Post: C3PO
  Python Custom Module not working in Jupyter Notebook with Pandas fid 0 2,043 Jul-04-2020, 11:05 AM
Last Post: fid
  How to change working directory in Jupyter Notebook? rajeev1729 2 21,095 Aug-25-2019, 07:25 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020