How to generate multiple line plots with facet grid in Seaborn

Hi, I am trying to plot this data given in the DQ exercise using seaborn. Is there any way to do it?

I saw in the conditional plot exercise that seaborn makes it easy to plot multiple plots but it shows only how to draw a histogram.

I also look at the seaborn official documentation but couldn’t able to find a way to do that.

To make things easier, I melted the women college degree data set which you can see in the attached pic.stem

catplot and relplot are good figure-level apis to start with. They allow many tweaks of presentation. I always liked editing plotting parameters rather than editing the underlying data to focus on what i want to show (eg. ylim xlim)

Hi Bhola,

Firstly, congratulations for extending your understanding of the topic by applying a different strategy to the task!

I’m not sure how comfortable you are at this stage in your learning journey with documentation, but if you look at the Seaborn documentation for FacetGrid it has lots of examples:

https://seaborn.pydata.org/generated/seaborn.FacetGrid.html

They start with histograms, but then also show scatter plots, line plots etc.

The crux is that once you have created your facetgrid, you can pass it different types of plot objects and it can apply those across the different categories.

The syntax is not straightforward, but the examples use built-in seaborn datasets, so you might be able to take one of the examples and start to play with it a little locally before applying it to the degrees data to get yourself comfortable with how things work.

1 Like