import numpy as np
from lets_plot import *
data = dict(
cond=np.repeat(['A','B'], 200),
rating=np.concatenate((np.random.normal(0, 1, 200), np.random.normal(1, 1.5, 200)))
)
plot = (ggplot(data, aes(x='rating', fill='cond'))
+ ggsize(500, 250)
+ geom_density(color='dark_green', alpha=.7) + scale_fill_brewer(type='seq')
+ theme(axis_line_y='blank')
)
# get just SVG (no JS)
import lets_plot._kbridge as kbr
plot_svg = kbr._generate_svg(plot.as_dict())
# show svg
from IPython.display import SVG
SVG(plot_svg)