This section talks about how to add polygons and other shapes and the different built-in shapes that Matplotlib provides.
Playing with polygons and shapes
Adding polygons and shapes to our plots
We will begin by importing what we need to from Matplotlib, as shown here:
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
# Set up figure size and DPI for screen demo
plt.rcParams['figure.figsize'] = (6,4)
plt.rcParams['figure.dpi'] = 150
nums = np.arange(0,10,0.1)
plt.plot(nums, np.sin(nums))
We will use the same sign plot as in the earlier section, Adding text to both axis and figure objects. As shown in the following output, this is the most basic sine plot and no annotations...