Playing with styles
Help Sergeant Laura try out a few different style options. Changing the plotting style is a fast way to change the entire look of your plot without having to update individual colors or line styles. Some popular styles include:
'fivethirtyeight'
- Based on the color scheme of the popular website'grayscale'
- Great for when you don't have a color printer!'seaborn'
- Based on another Python visualization library'classic'
- The default color scheme for Matplotlib
This exercise is part of the course
Introduction to Data Science in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Change the style to fivethirtyeight
plt.____.____(____)
# Plot lines
plt.plot(data["Year"], data["Phoenix Police Dept"], label="Phoenix")
plt.plot(data["Year"], data["Los Angeles Police Dept"], label="Los Angeles")
plt.plot(data["Year"], data["Philadelphia Police Dept"], label="Philadelphia")
# Add a legend
plt.legend()
# Display the plot
plt.show()