Locked lesson.
About this lesson
Scatter plots are a bit more complicated, but can be helpful ways to visualize your data.
Exercise files
Download this lesson’s related exercise files.
Plotting Scatter Plots.docx57.1 KB Plotting Scatter Plots - Solution.docx
55.6 KB
Quick reference
Plotting Scatter Plots
There are two methods to create scatter plots.
When to use
Use these methods whenever you want to create a scatter plot.
Instructions
The first method to create a scatter plot is:
my_df.plot(kind='scatter', x='Mon', y='Wed')
To analyze the scatter plot against a third column:
my_df.plot(kind='scatter', x='Mon', y='Wed', c="Tues")
To change the color of a scatter plot, use a cmap:
my_df.plot(kind='scatter', x='Mon', y='Wed', c="Tues", cmap='Wistia')
To analyze the scatter plot by size:
my_df.plot(kind='scatter', x='Mon', y='Wed', c="Tues", cmap='Wistia', s=my_df['Wed']*100, alpha=0.4)
The second method for creating a scatter plot is:
my_df.plot.scatter(x="Mon", y="Wed")
Hints & tips
- cmap reference: https://matplotlib.org/tutorials/colors/colormaps.html
Lesson notes are only available for subscribers.