Making use of text and font properties
You already learned how to annotate the plot by adding legends, but sometimes we want more with text. This recipe will explain and demonstrate more features of text manipulation in matplotlib, giving a powerful toolkit for even advanced typesetting needs.
We will not cover LaTeX support in this recipe, as there is a recipe named Rendering text with LaTeX in this chapter.
Getting ready
We start with listing of the most useful set of functions that matplotlib offers. Most of the functions are available via pyplot
module's interface, but we map their origin function here to allow you to explore more if a particular text feature is not covered in this recipe.
Basic text manipulations and their mapping in matplotlib OO API is presented in the following table:
matplotlib.pyplot |
Matplotlib API |
Description |
---|---|---|
|
|
Adds text to the axes at the location specified by (x, y). Argument |