From the course: Python Functions for Data Science

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Matplotlib scatter plots

Matplotlib scatter plots - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Matplotlib scatter plots

- [Instructor] Scatter plots are commonly used when visualizing data. In this video, I will show you how to create a scatter plot using Matplotlib. Let's say I have a pandas DataFrame containing the sales in dollars of an ice cream truck for 14 days and the temperature in Fahrenheit for each day as shown here. Now, say I want to create a scatter plot of this data. I can use the scatter function from the pyplot submodule of Matplotlib. It would look like this. First, I'll call the scatter function and pass in the temp column and the ice cream truck sale column from the sales DataFrame in that order. Next, I'll call the xlabel function to set the label of the x-axis. Then, I'll call the ylabel function to set the label of the y-axis. Next, I'll call the title function to set the title of the plot. Lastly, I'll call the show function to make sure that the plot gets displayed. That's it. Now that you've seen how…

Contents