Python Data Visualization Transcripts
Lecture: Catplot API summary
0:00 Now I'll show you how to use the cat plot to do some similar analysis. Well look at the same data and show a box plot that compares the average fuel
0:11 economy for the two different date ranges And I've also passed the parameter, show fliers equals false to clean up the visualization a little bit.
0:20 The other thing we can do with the cat plot. So it's very easy to also show other types of plots.
0:28 So I will do this with a boxing plot which is have an interesting little plot to show how the boxes are stacked on top of each other.
0:39 And then if we want to start fastening the data to look at it, we can do that as well.
0:46 So let's take a look at the date range and we'll add a column and now we have box plots for the various date ranges with a column for gas,
1:01 diesel, other and electric. So it makes it very easy to see that there's
1:06 a much different range for the electric vehicles than the fossil fuel vehicles, which makes a lot of sense. Sometimes when we have a lot of columns,
1:18 we may want to just wrap it. So let's do this so that we get more of a 2 x 2 matrix. It's a handy way depending on the data.
1:31 You have to summarize it. What I also like about the catplot Is that we can use the point plot to see trends over time.
1:43 So this will show the average highway 08-fuel economy per year and you can see how it increases quite a bit over time.
1:53 Let's get a little more sophisticated view of this. I can do a point plot as well for this one just like I did here
2:01 but I can say I don't want to join the lines together so that I can see the trends for the highway fuel economy over time as well as the fuel
2:12 type summary. So this is another way to look at the data and depending on your unique data sets, this could be a helpful way,
2:21 but it does highlight just how much flexibility there is with the cat plot.
2:26 Another plot that I like to use quite a bit from a category plot perspective is
2:31 the bar plot and I'll use some of the same variables that we've looked at before But one of the things I do here is set share X equals to false
2:40 And what that allows us to do is to show different values on the X axis. So I can show these two years kind of compare them against each other
2:53 And this is a nice way to see changes over time. I'm also comparing that electric fuel economy versus other fuel economies.
3:04 You can see there's a period of time where there aren't that many electric cars and then once we get into 2011 above,
3:09 there's a lot more examples of electric cars and the highway fuel economy for them.
3:16 Why don't we combine this all by doing the cylinders and the combined fuel economy. I'll also include a column for the drive.
3:25 We'll put a role for the date range, will show the transmission and do a bar chart as well.
3:32 So this gives us a lot of data in these charts using a very simple, consistent API.
3:40 And by varying these values. It's really a quick and efficient way to look at your data, analyze it and see what insights you have and what you need to
3:49 do to solve your own unique problems.