6Drawing Geometric Shapes and Fractals

image

In this chapter, we’ll start by learning about patches in matplotlib that allow us to draw geometric shapes, such as circles, triangles, and polygons. We’ll then learn about matplotlib’s animation support and write a program to animate a projectile’s trajectory. In the final section, we’ll learn how to draw fractals—complex geometric shapes created by the repeated applications of simple geometric transformations. Let’s get started!

Drawing Geometric Shapes with Matplotlib’s Patches

In matplotlib, patches allow us to draw geometric shapes, each of which we refer to as a patch. You can specify, for example, ...

Get Doing Math with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.