lets-plot icon indicating copy to clipboard operation
lets-plot copied to clipboard

Using range in scales

Open ASmirnov-HORIS opened this issue 5 years ago • 0 comments

If I need to specify breaks parameter in scale_***(), I have to transform my values into list. Generators are not available, even the simple range:

import numpy as np

from lets_plot import *
LetsPlot.setup_html()

np.random.seed(42)

data = {'rating': np.round(np.random.normal(loc=7, scale=1, size=100), 1)}

ggplot(data) + \
    geom_histogram(aes(x='rating'), binwidth=.25, center=0) + \
    scale_x_continuous(breaks=range(1, 11))

Here I got an exception: Not a List: breaks: String.

ASmirnov-HORIS avatar Jan 27 '21 13:01 ASmirnov-HORIS