matplotlib

Travis-CI:

This Page

matplotlib.axes.Axes.set_xlim

Axes.set_xlim(left=None, right=None, emit=True, auto=False, **kw)

Set the data limits for the xaxis

Call signature:

set_xlim(self, *args, **kwargs):

Set the data limits for the xaxis

Examples:

set_xlim((left, right))
set_xlim(left, right)
set_xlim(left=1) # right unchanged
set_xlim(right=1) # left unchanged

Keyword arguments:

left: scalar
The left xlim; xmin, the previous name, may still be used
right: scalar
The right xlim; xmax, the previous name, may still be used
emit: [ True | False ]
Notify observers of limit change
auto: [ True | False | None ]
Turn x autoscaling on (True), off (False; default), or leave unchanged (None)

Note, the left (formerly xmin) value may be greater than the right (formerly xmax). For example, suppose x is years before present. Then one might use:

set_ylim(5000, 0)

so 5000 years ago is on the left of the plot and the present is on the right.

Returns the current xlimits as a length 2 tuple

ACCEPTS: length 2 sequence of floats