matplotlib.pyplot.ylim
-
matplotlib.pyplot.ylim(*args, **kwargs)
[source] -
Get or set the y-limits of the current axes.
Call signatures:
ymin, ymax = ylim() # return the current ylim ylim((ymin, ymax)) # set the ylim to ymin, ymax ylim(ymin, ymax) # set the ylim to ymin, ymax
If you do not specify args, you can alternatively pass ymin or ymax as kwargs, i.e.:
ylim(ymax=3) # adjust the max leaving min unchanged ylim(ymin=1) # adjust the min leaving max unchanged
Setting limits turns autoscaling off for the y-axis.
Returns: - ymin, ymax
-
A tuple of the new y-axis limits.
Notes
Calling this function with no arguments (e.g.
ylim()
) is the pyplot equivalent of callingget_ylim
on the current axes. Calling this function with arguments is the pyplot equivalent of callingset_ylim
on the current axes. All arguments are passed though.
Examples using matplotlib.pyplot.ylim
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/2.2.3/api/_as_gen/matplotlib.pyplot.ylim.html