coord_flip#

coord_flip(xlim=None, ylim=None)#

Flip axis of default coordinate system so that horizontal axis becomes vertical and vice versa.

Parameters:
xlimlist

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.

ylimlist

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.

Returns:
FeatureSpec

Coordinate system specification.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4np.random.seed(42)
 5n = 10
 6x = np.arange(n)
 7y = 1 + np.random.randint(5, size=n)
 8ggplot() + \
 9    geom_bar(aes(x='x', y='y', fill='x'), data={'x': x, 'y': y}, \
10             stat='identity', show_legend=False) + \
11    scale_fill_discrete() + \
12    coord_flip()