xlim#

xlim(*limits)#

This is a shortcut for supplying the limits parameter to the x axis. Observations outside the range will be dropped.

Parameters:
limits

Limits (2 parameters) for the x axis. 1st parameter defines lower limit, 2nd parameter defines upper limit. None value means no bounds.

Returns:
FeatureSpec

Scale specification.

Examples

1import numpy as np
2from lets_plot import *
3LetsPlot.setup_html()
4n = 1000
5np.random.seed(42)
6x = np.random.normal(size=n)
7y = np.random.normal(size=n)
8ggplot({'x': x, 'y': y}, aes('x', 'y')) + \
9    geom_point() + xlim(-1, 1)