Changing style and palette
Let's return to our dataset containing the results of a survey given to young people about their habits and preferences. We've provided the code to create a count plot of their responses to the question "How often do you listen to your parents' advice?". Now let's change the style and palette to make this plot easier to interpret.
We've already imported Seaborn as sns
and matplotlib.pyplot
as plt
.
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.
# Set the style to "whitegrid"
# Create a count plot of survey responses
category_order = ["Never", "Rarely", "Sometimes",
"Often", "Always"]
sns.catplot(x="Parents Advice",
data=survey_data,
kind="count",
order=category_order)
# Show plot
plt.show()