Creating two-factor subplots
Let's continue looking at the student_data
dataset of students in secondary school. Here, we want to answer the following question: does a student's first semester grade ("G1"
) tend to correlate with their final grade ("G3"
)?
There are many aspects of a student's life that could result in a higher or lower final grade in the class. For example, some students receive extra educational support from their school ("schoolsup"
) or from their family ("famsup"
), which could result in higher grades. Let's try to control for these two factors by creating subplots based on whether the student received extra educational support from their school or family.
Seaborn has been imported as sns
and matplotlib.pyplot
has been imported 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.
# Create a scatter plot of G1 vs. G3
# Show plot
plt.show()