How it works…
The code starts by importing the Artist subclasses that we will use in the example, which include Rectangle, Circle, Polygon, and Text.
We then create a figure and add a single subplot to the figure using the add_subplot() method. This method returns an object of type Axes, which we store in the ax variable.
The Axes class is the workhorse of the Matplotlib library. Although it is possible to generate plots using lower-level calls, using the Axes object is sufficient for the vast majority of applications.
Next, we set the options for the ax object, which specify the general appearance of the graph. This is done with the ax.update(options) method call, where options is a Python dictionary. In our example, the following options ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access