Matplotlib.pyplot.xlim() in Python
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. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc.
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
The xlim() function in pyplot module of matplotlib library is used to get or set the x-limits of the current axes.
Parameters: This method accept the following parameters that are described below:
- left: This parameter is used to set the xlim to left.
- right: This parameter is used to set the xlim to right.
- **kwargs: This parameter is Text properties that is used to control the appearance of the labels.
Returns: This returns the following:
- left, right: This returns the tuple of the new x-axis limits.
Below examples illustrate the matplotlib.pyplot.ylim() function in matplotlib.pyplot: