One last piece of theory you need to understand is the differences between stateless and stateful interfaces. Pyplot is the stateful interface of matplotlib
.
This means that, behind the scenes, Pyplot stores the state of your figure and axes objects, so you don’t have to. Pyplot is great for creating quick plots in an interactive shell.
This code example uses Pyplot to plot a basic line in a plot:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 1, 0.1)
y = np.arange(10)
plt.title("pyplot demo")