Python Data Visualization Transcripts
Chapter: Matplotlib
Lecture: Interface types
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
The second concept I want to talk about that can be really confusing for new mat-
0:04
plot lib users is the fact that there are actually two interfaces to generating your visualization
0:11
So the first one is a pyplot or a functional state based interface. And this is based off a matlab and it's designed for simple interactive plots and
0:24
it relies on pyplot to automatically create and manage the figures and axes that we talked about in the previous section.
0:33
The other approach is the object oriented approach where you create your figures and axes and then call methods on them to update them.
0:42
Here's an example using pyplot of generating a simple histogram where you can
0:47
see that the plot keeps track of the current figure and axes and just updates it with these commands. Whereas the object oriented approach,
0:57
you create the figure in the axis using the subplots function. Then you update that axis with the histogram, your x labels your y labels,
1:08
titles and then show that overall figure pyplot is around for that mat lab experience and has been around for a long time.
1:17
So a lot of the examples you're going to see online will be in the py
1:20
plot format but you should try and translate it internally into the object oriented approach, for
1:27
this course I will focus on the object oriented approach because that gives you the
1:31
most flexibility and the most ability to update and interact with some of the other libraries they were going to be discussing.