from lets_plot import *
import pandas as pd
LetsPlot.setup_html()
iris = pd.read_csv('https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/iris.csv')
p = ggplot(iris, aes(x='petal_length', fill='species')) + facet_wrap(facets='species', scales='free_x')
gggrid([
ggplot(iris, aes(x='petal_length', fill='species')) \
+ facet_wrap(facets='species', scales='free_x') \
+ geom_histogram(alpha=.5, bins=3, threshold=0, show_legend=False),
ggplot(iris, aes(x='petal_length', fill='species')) \
+ facet_wrap(facets='species') \
+ geom_histogram(alpha=.5, bins=3, threshold=0, show_legend=False)
])
ggplot(iris, aes(x='petal_length', fill='species')) \
+ facet_wrap(facets='species', scales='free_x') \
+ geom_histogram(alpha=.5, bins=4, threshold=0)
p + geom_histogram(alpha=.5, bins=4, threshold=0)
import numpy as np
np.random.seed(42)
x = np.random.poisson(size=100)
ggplot({'x': x}, aes(x='x')) + geom_histogram() + scale_y_log2()