matplotlib.pyplot.xlim
-
matplotlib.pyplot.xlim(*args, **kwargs)
[source] -
Get or set the x limits of the current axes.
Call signatures:
xmin, xmax = xlim() # return the current xlim xlim((xmin, xmax)) # set the xlim to xmin, xmax xlim(xmin, xmax) # set the xlim to xmin, xmax
If you do not specify args, you can pass xmin or xmax as kwargs, i.e.:
xlim(xmax=3) # adjust the max leaving min unchanged xlim(xmin=1) # adjust the min leaving max unchanged
Setting limits turns autoscaling off for the x-axis.
Returns: - xmin, xmax
-
A tuple of the new x-axis limits.
Notes
Calling this function with no arguments (e.g.
xlim()
) is the pyplot equivalent of callingget_xlim
on the current axes. Calling this function with arguments is the pyplot equivalent of callingset_xlim
on the current axes. All arguments are passed though.
Examples using matplotlib.pyplot.xlim
© 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.xlim.html