Changing the scale
In this exercise, we'll continue to look at the dataset containing responses from a survey of young people. Does the percentage of people reporting that they feel lonely vary depending on how many siblings they have? Let's find out using a bar plot, while also exploring Seaborn's four different plot scales ("contexts").
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 context to "paper"
# Create bar plot
sns.catplot(x="Number of Siblings", y="Feels Lonely",
data=survey_data, kind="bar")
# Show plot
plt.show()