Download notebook (.ipynb)

Raincloud Plot#

import pandas as pd

from lets_plot import *
LetsPlot.setup_html()
df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/refs/heads/master/data/penguins.csv")
print(df.shape)
df.head()
(344, 7)
ggplot(df, aes("species", "bill_depth_mm", color="species", fill="species")) + \
    geom_violin(show_half=1, alpha=.75, trim=False,
                position=position_nudge(x=.07),
                tooltips=layer_tooltips().format("@..violinwidth..", ".3~g")) + \
    geom_sina(show_half=-1, fill="white", shape=21, seed=42, show_legend=False,
              position=position_nudge(x=-.07)) + \
    geom_boxplot(width=.1, outlier_alpha=0, show_legend=False) + \
    scale_color_brewer(palette="Set2") + \
    scale_fill_brewer(palette="Pastel2") + \
    coord_flip() + \
    ylab("bill depth (mm)") + \
    theme_light() + \
    flavor_solarized_dark() + \
    ggsize(800, 600)