Python Data Visualization Transcripts
Chapter: Matplotlib
Lecture: Pyplot example

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now that we have the data loaded into our data frame. Let's do a really simple histogram plot before you plot something in a jupyter
0:09 notebook. Sometimes you may need to use a magic command to tell it that you're plotting with matplot-lib. Now in more recent versions of notebooks,
0:19 you may not have to do this, but I want to point it out because you're going to see this a lot in
0:23 online documentation. So now we've told the notebook that we're going to plot a mat plot lib plot. Let's do a very simple histogram and I like
0:33 using histograms because it's just one variable that we're looking at. In this case, we're going to plot a histocomb of the combined fuel economy
0:42 for all of the values. Now, one of the things you'll notice is that the Histogram is fairly straightforward,
0:48 but you've got all this other information that is getting returned and a lot of times you're not gonna want to see that all the time.
0:55 So there's a little trick you can do if you add that semicolon at the end it will suppress that information.
1:03 So sometimes I will be doing that in the course. And what I'm showing you as an example of the state based interface using pyplot
1:12 that I talked about that we don't want to use. So I'm going to go through that example just a little bit more detail so you
1:18 can see how it works and I'll compare it and contrast with the object oriented interface
1:22 So let me show how to customize the plot using the pyplot interface.
1:45 So I've expand the example so that the plot has more information about what's going on So I continue to do the histogram.
1:53 Then I labeled the X and Y axis with the number of cars and the combined fuel economy. I added a title and then I used plot.show to make
2:03 sure that the final visualization is shown. Now we will go through the object oriented api and show how that works.


Talk Python's Mastodon Michael Kennedy's Mastodon