VOOZH about

URL: https://www.geeksforgeeks.org/python/matplotlib-axes-axes-set_ylim-in-python/

⇱ Matplotlib.axes.Axes.set_ylim() in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Matplotlib.axes.Axes.set_ylim() in Python

Last Updated : 12 Jul, 2025
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.
matplotlib.axes.Axes.set_ylim() Function:
The Axes.set_ylim() function in axes module of matplotlib library is used to set the y-axis view limits.
Syntax: Axes.set_ylim(self, bottom=None, top=None, emit=True, auto=False, *, ymin=None, ymax=None) Parameters: This method accepts the following parameters.
  • bottom : This parameter is the bottom ylim in data coordinates
  • top : This parameter is the top ylim in data coordinates
  • emit : This parameter is used to notify observers of limit change.
  • auto : This parameter is used to turn on autoscaling of the x-axis.
  • ymin, ymax: These parameter are equivalent to bottom and top and it is an error to pass both ymin and bottom or ymax and top.
Returns:This method returns the following
  • bottom, top:This returns the new y-axis limits in data coordinates.
Below examples illustrate the matplotlib.axes.Axes.set_ylim() function in matplotlib.axes: Example 1: Output: 👁 Image
Example 2:
Comment
Article Tags: