December 2017
Intermediate to advanced
386 pages
10h 42m
English
Enter the following code in a Jupyter execution cell and run it:
from matplotlib.patches import Rectangle, Circle, Polygonfrom matplotlib.text import Textfig = plt.figure()ax = fig.add_subplot(1,1,1)options = dict(xlim=(0,20), ylim=(0,20), aspect='equal', xticks=[], yticks=[])ax.update(options)rect = Rectangle((3,3), width=7, height=7, color='orange', ec='black')circle = Circle((13,6.5), radius=5, color='green', ec='darkgreen', alpha=0.7)vertices = np.array([[1, 11],[10,18], [15,5],[2,19]])poly = Polygon(vertices, color='blue', lw=4, closed=False, fill=None)for patch in [rect, circle, poly]: ax.add_patch(patch)text = Text(12, 14, "Hello,\nWorld!", color='red', family='sans-serif', fontsize=26)ax.add_artist(text)None
Running ...
Read now
Unlock full access