Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The
figure module provides the top-level Artist, the Figure, which contains all the plot elements. This module is used to control the default spacing of the subplots and top level container for all plot elements.
matplotlib.figure.Figure.text() method
The
text() method figure module of matplotlib library is used to Add text to figure.
Syntax: text(self, x, y, s, fontdict=None, withdash=, **kwargs)
Parameters: This method accept the following parameters that are discussed below:
- x: This parameter is the x position to place the text.
- y: This parameter is the y position to place the text.
- s: This parameter is the text string.
- fontdict : This parameter is the dictionary to override the default text properties.
- withdash : This parameter is used to create a TextWithDash instance instead of a Text instance.
Returns: This method returns the Text.
Below examples illustrate the matplotlib.figure.Figure.text() function in matplotlib.figure:
Example 1:
Output:
👁 Image
Example 2: