lets_plot.coord_fixed

lets_plot.coord_fixed(ratio=1.0, xlim=None, ylim=None, flip=False)

A fixed scale coordinate system forces a specified ratio between the physical representation of data units on the axes.

Parameters
ratiofloat

The ratio represents the number of units on the y-axis equivalent to one unit on the x-axis. ratio = 1, ensures that one unit on the x-axis is the same length as one unit on the y-axis. Ratios higher than one make units on the y-axis longer than units on the x-axis, and vice versa.

xlimlist

Limits (2 numbers) for the x axis. 1st element defines lower limit, 2nd element defines upper limit. None means no lower / upper bound - depending on the index in list.

ylimlist

Limits (2 numbers) for the y axis. 1st element defines lower limit, 2nd element defines upper limit. None means no lower / upper bound - depending on the index in list.

flipbool

Flips the coordinate system axisso that horizontal axis becomes vertical and vice versa.

Returns
FeatureSpec

Coordinate system specification.

Examples

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