lets_plot.coord_cartesian

lets_plot.coord_cartesian(xlim=None, ylim=None, flip=False)

The Cartesian coordinate system is the most familiar and common type of coordinate system. Setting limits on the coordinate system will zoom the plot like you’re looking at it with a magnifying glass. It does not change the underlying data as setting limits on a scale does.

Parameters
  • xlim (list) – Limits (2 elements) 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.

  • ylim (list) – Limits (2 elements) 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.

  • flip (bool) – Flips the coordinate system axisso that horizontal axis becomes vertical and vice versa.

Returns

Coordinate system specification.

Return type

FeatureSpec

Examples

1from lets_plot import *
2LetsPlot.setup_html()
3data = {'x': [0, 8, 12, 17, 20, 26],
4        'y': [0, 8, 12, 17, 20, 26],
5        'g': ['a', 'a', 'b', 'b', 'c', 'c']}
6ggplot(data) + geom_line(aes(x='x', y='y', group='g')) + \
7    coord_cartesian(xlim=(4, 23), ylim=(3, 22))