Python Data Visualization Transcripts
Chapter: Seaborn
Lecture: Relplot
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We've gone through examples of the dist plot and the cat plot. And now we'll talk about doing the relplot.
0:06
So the relationship plot allows us to plot two variables against each other.
0:11
In this example, we're going to plot the number of cylinders and the combined fuel
0:16
economy. The default version of this is a scatter plot which we can replicate using a scatter plot similar to what we've done before.
0:28
Where it generates a matplot lib, plot versus the Seaborn access grid plot. The other type of plot we can do with the relationship plot or rel plot is
0:40
a line plot. So let's copy this and change the kind that kind of line and now we have a line plot. What is nice about the relations plot?
0:56
We can also do some other interesting things. Let's say we want to add color. And this is where Seaborn really shines. It has a very simple API.
1:09
We passed the data, the X, the Y, the kind and the huge, just like we have with all of our other plots.
1:16
And behind the scenes it takes our data frame splits out the data by the cylinders
1:21
And the combined fuel economy then plots different line plots with an error range,
1:30
as you can see by the lightly shady color for the automatic versus the manual transmission
1:35
And this type of quick iterative approach is where Seaborn really shines and you can see some of the promise of these plots talked through far.