Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute.
The Axes.fill_betweenx() function in axes module of matplotlib library is used to fill the area between two vertical curves.
Syntax: Axes.fill_betweenx(self, y, x1, x2=0, where=None, step=None, interpolate=False, *, data=None, **kwargs)
Parameters: This method accept the following parameters that are described below:
- y: This parameter contains the y coordinates of the data points which are used to define the curves.
- x1: This parameter contains the x coordinates of the data points which are used to define the first curves
- x2: This parameter contains the x coordinates of the data points which are used to define the second curves. It is an optional with default value of 0.
- where: This parameter is an optional parameter. And it is used to exclude some horizontal regions from being filled.
- interpolate: This parameter is also an optional parameter. And it is the linewidth of the errorbar lines with default value NONE.
- step: This parameter is also an optional parameter. And it is used to define if the filling should be a step function or not.
Returns: This returns a PolyCollection containing the plotted polygons.
Below examples illustrate the matplotlib.axes.Axes.fill_betweenx() function in matplotlib.axes:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course