August 2017
Beginner to intermediate
334 pages
8h 22m
English
We have introduced ways to put arrows before. The patches class in Matplotlib defines a number of other shapes, including Circle, Ellipse, Wedge, and Polygon. Various relevant shapes, including sectors and rings, can also be drawn. For demonstration purposes, we draw a cartoon with different patches to locate the different shapes and vertex coordinates intuitively:
import numpy as npfrom matplotlib.patches import Circle, Wedge, Polygon, Ellipsefrom matplotlib.collections import PatchCollectionimport matplotlib.pyplot as pltfig, ax = plt.subplots()patches = []# Full and ring sectors drawn by Wedge((x,y),r,deg1,deg2)leftstripe = Wedge((.46, .5), .15, 90,100) # Full sector by defaultmidstripe = Wedge((.5,.5), .15, 85,95) rightstripe ...
Read now
Unlock full access