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: |
|
---|
Notes
Calling this function with no arguments (e.g. xlim()
) is the pyplot
equivalent of calling get_xlim
on the current axes.
Calling this function with arguments is the pyplot equivalent of calling
set_xlim
on the current axes. All arguments are passed though.