42.1: Matplotlib
- Page ID
- 70553
We will be using the matplotlib
library quite a bit to visualize the concepts in this course. This is a very big library with a lot of components. Here are some basics to get you started.
First, in order to see the figures generated by the matplotlib
library in a jupyter notebook you will need to add the following like to a code cell somewhere near the top of the notebook. This like of code must run before any figures will display.
Next, we typically we import either the pylab
or pyplot
packages from the matplotlib
library using one of the following import statements. In most cases these statements are interchangeable, however, in this class we will generally stick to using pyplot
because it has a little more functionality.
or
The basic way to plot values is to use the plot
function as follows:
The matplotlib
library is big!!! There is no way we can cover all of the topics in this notebook. However, it is not that hard to use and there are plenty of tutorials and examples on the Internet.
Review the matplotlib
examples in the Matplotlib Example Gallery.