November 2018
Beginner to intermediate
214 pages
5h 2m
English
You can also make your own polygons by specifying where those vertices lie. In the following code, we can see that there are four vertices corresponding to a trapezoid, as follows:
# Making your own polygonspos = [(3,0),(7,0), (6,1), (4,1)]poly = mpl.patches.Polygon(pos)plt.plot(nums, 10/3.*np.sin(nums))plt.gca().add_patch(poly)
When we run this code, we get a trapezoid, as shown here:

Matplotlib provides the ability to build much more complicated and sophisticated shapes using paths. It is recommended to take a look at the matplotlib.path module. In the path module, we can see that there is a module available for ...
Read now
Unlock full access