Python Data Visualization Transcripts
Chapter: Seaborn
Lecture: Catplot
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
So let's continue to explore the Seaborn API by doing a cat plot now it uses a very similar api structure as the dis plot except it's gonna do
0:13
a plot of each individual point horizontally which is essentially the same as a strip plot similar to what we showed with the hist plot.
0:25
So now you can see the difference, that's the seaborn object versus the matplot lib object for the strip plot.
0:32
So let's try a couple other types of category plots. Let's say we want to do a box plot pass in the kind as box.
0:49
Now we have our box plot and I'm actually gonna change this. So it's on the Y axis a little more standard. So now you can see we have a box plot.
1:00
So a bunch of different kinds we can do. Here's a kind of interesting one that you may not have seen before called
1:06
a box in plot boxing. So it's got little little boxes, it's a little easier to see the data.
1:14
Another one that's pretty common and useful is a violin plot and it shows another view of the distribution of the data.
1:25
So one that I wanted to talk about is there is a plot called the bar plot so we pass kind equals bar.
1:36
What it's going to give us is the average for the combined fuel economy with an error bar and that in and of itself,
1:45
you know is not that useful but what is interesting is when we combine it with other variables. So let's combine that,
1:56
let's do the data. Let's keep the, put that on the y axis like we have there and let's put something different on the X. Let's look at cylinders.
2:12
Now this is a little more interesting and useful plot and starts to get at what
2:17
seaborn does really well. What it has done is plotted the average combined fuel economy or combo eight based on the number of cylinders.
2:27
You can see that two cylinder engines are relatively efficient.
2:32
Three cylinder is very efficient although three cylinder engine is kind of unique engine structure and
2:38
then it goes down quite a bit as the cylinders go up as you would expect because those engines are less fuel efficient.
2:45
And Seaborn does a nice job of making it really easy to do these kinds of
2:50
plots and do the underlying math behind the scenes so that you don't have to do it. Let's take a look at another type of plot that might be a little
3:00
bit different in and of itself might not make a whole lot of sense. And let's use a point plot and a point plot gives us an average with
3:08
bars. Now let's show how to maybe take this bar plot that we did and plot that as a point plot.
3:19
I think it'll make a little more sense about what how that can be useful. And now we can see a nice trend of how the average goes down as the
3:27
cylinders go up once we go past a four cylinder engine.