The focus of this chapter is on two-dimensional geometry, so our first task is to learn how to visualize two-dimensional geometric figures. Some of the techniques and tools mentioned here might be applicable to three-dimensional geometric figures, but generally, this will require more specialized packages and tools.
A geometric figure, at least in the context of this book, is any point, line, curve, or closed region (including the boundary) whose boundary is a collection of lines and curves. Simple examples include points and lines (obviously), rectangles, polygons, and circles.
In this recipe, we will learn how to visualize geometric figures using Matplotlib.
Getting ready
For this recipe, we need the NumPy package imported as np, and the Matplotlib pyplot module imported as plt. We also need to import the Circle class from the Matplotlib patches module and the PatchCollection class from the Matplotlib...