Matplotlib

3. Matplotlib#

Matplotlib is a Python module that allows you to create visualizations. Until now, you have probably used Excel to make graphs, but Python offers much more versatility. In this section, you will learn how to use matplotlib to make good-looking graphs.

As always, let’s import the module. We will also import numpy and pandas.

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

From the matplotlib library we will discuss the following functions:

  • plt.subplot()

  • plt.plot()

  • plt.title()

  • plt.suptitle()

  • plt.xlabel() and plt.ylabel()

  • plt.xlim() and plt.ylim()

  • plt.legend()

  • plt.grid()

  • plt.show()