Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library.
Pyplot is a state-based interface to a
Matplotlib module which provides a MATLAB-like interface.
matplotlib.pyplot.annotate() Function
The
annotate() function in pyplot module of matplotlib library is used to annotate the point xy with text s.
Syntax: angle_spectrum(x, Fs=2, Fc=0, window=mlab.window_hanning, pad_to=None, sides='default', **kwargs)
Parameters: This method accept the following parameters that are described below:
- s: This parameter is the text of the annotation.
- xy: This parameter is the point (x, y) to annotate.
- xytext: This parameter is an optional parameter. It is The position (x, y) to place the text at.
- xycoords: This parameter is also an optional parameter and contains the string value.
- textcoords: This parameter contains the string value.Coordinate system that xytext is given, which may be different than the coordinate system used for xy
- arrowprops : This parameter is also an optional parameter and contains dict type.Its default value is None.
- annotation_clip : This parameter is also an optional parameter and contains boolean value.Its default value is None which behaves as True.
Returns: This method returns the annotation.
Below examples illustrate the matplotlib.pyplot.annotate() function in matplotlib.pyplot:
Example #1:
Output:
👁 Image
Example #2: