Building a FacetGrid
Seaborn's FacetGrid
is the foundation for building data-aware grids. A data-aware grid allows
you to create a series of small plots that can be useful for understanding complex data
relationships.
For these exercises, we will continue to look at the College Scorecard Data from the US Department of Education. This rich dataset has many interesting data elements that we can plot with Seaborn.
When building a FacetGrid
, there are two steps:
- Create a
FacetGrid
object with columns, rows, or hue. - Map individual plots to the grid.
This exercise is part of the course
Intermediate Data Visualization with Seaborn
Exercise instructions
- Create a
FacetGrid
that shows a point plot of the Average SAT scoresSAT_AVG_ALL
. - Use
row_order
to control the display order of the degree types.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create FacetGrid with Degree_Type and specify the order of the rows using row_order
g2 = sns.____(df,
____="Degree_Type",
row_order=['Graduate', 'Bachelors', 'Associates', 'Certificate'])
# Map a pointplot of SAT_AVG_ALL onto the grid
g2.____(sns.____, 'SAT_AVG_ALL')
# Show the plot
plt.show()
plt.clf()