Visualizing Apple Price Trends with Scatter Plots in Python

Visualize highest and lowest Apple prices with scatter plot markers using matplotlib and API data.

Enhance data visualization by integrating scatter plots to highlight critical data points clearly and effectively. Learn how to customize markers, colors, and sizes to make financial data insights more visible.

Key Insights

  • Utilize scatter plots within pyplot to visually represent critical data points such as highest and lowest Apple stock prices.
  • Customize visual attributes by using distinct features like green star markers for highs and red star markers for lows, enhancing clarity and readability.
  • Access and visualize accurate financial data clearly and quickly through APIs, improving the overall effectiveness of data-driven visualizations.

Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.

Let's add scatter plots for the high and the low. All right, we'll say pyplot.scatter. There it is. We give an X and a Y point—where X is the date and Y is the price.

highest_apple_price. And then we can add some things to make it look better. Make the marker a little star.

Set the color to green—since it's the high, green feels appropriate. And make the size large so this is very visible. And there we go.

Big green star up there. Let's do the same thing. I’ll copy and paste this for the low.

low_date, lowest_apple_price. Let's change the color to red. And there it is.

Python for Data Science Bootcamp: Live & Hands-on, In NYC or Online, Learn From Experts, Free Retake, Small Class Sizes,  1-on-1 Bonus Training. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

There’s our low, right there. Okay, so what's the takeaway here? We've explored a great way to use APIs to get our data. Let's sum that up in a little more detail in the next video.

Colin Jaffe

Colin Jaffe is a programmer, writer, and teacher with a passion for creative code, customizable computing environments, and simple puns. He loves teaching code, from the fundamentals of algorithmic thinking to the business logic and user flow of application building—he particularly enjoys teaching JavaScript, Python, API design, and front-end frameworks.

Colin has taught code to a diverse group of students since learning to code himself, including young men of color at All-Star Code, elementary school kids at The Coding Space, and marginalized groups at Pursuit. He also works as an instructor for Noble Desktop, where he teaches classes in the Full-Stack Web Development Certificate and the Data Science & AI Certificate.

Colin lives in Brooklyn with his wife, two kids, and many intricate board games.

More articles by Colin Jaffe

How to Learn Python

Master Python with hands-on training. Python is a popular object-oriented programming language used for data science, machine learning, and web development. 

Yelp Facebook LinkedIn YouTube Twitter Instagram