Importing Libraries

Plotting Basics

Importing Libraries

🙋 Need help? Ask an expert now!


One of the most important aspects of python is the ability to take work that has already been done, and re-use it. In our case, we are going to be using a library that was created specifically for plotting in python. This means that every time that we want to plot, we will need to import this library. Below is a very basic script that just imports the library that we are going to be using.

For every script in this course we will always be importing matplotlib.pyplot

As well, we don't want to have to type matplotlib.pyplot every time that we want to reference the library, so we also give it a pseudonym and call it plt. This means that any time that we want to use this specific library, we can reference it directly by calling it plt. See more below for a specific example!

import matplotlib.pyplot as plt

In addition, we can import other libraries which might be useful to us. In general, numpy tends to be very nice as it allows mathematical operations with vectors, so you may hear me reference this commonly as well.

Edit Me on GitHub!