Changing the size of scatter plot points
In this exercise, we'll explore Seaborn's mpg
dataset, which contains one row per car model and includes information such as the year the car was made, the number of miles per gallon ("M.P.G.") it achieves, the power of its engine (measured in "horsepower"), and its country of origin.
What is the relationship between the power of a car's engine ("horsepower"
) and its fuel efficiency ("mpg"
)? And how does this relationship vary by the number of cylinders ("cylinders"
) the car has? Let's find out.
Let's continue to use relplot()
instead of scatterplot()
since it offers more flexibility.
This exercise is part of the course
Introduction to Data Visualization with Seaborn
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import Matplotlib and Seaborn
import matplotlib.pyplot as plt
import seaborn as sns
# Create scatter plot of horsepower vs. mpg
# Show plot
plt.show()