11  boxplot

import cellestial as cl
import scanpy as sc
from lets_plot import *

LetsPlot.setup_html()

data = sc.read("data/pbmc3k_mini.h5ad")

11.1 A simple boxplot

cl.boxplot(
    data,
    "pct_counts_in_top_50_genes",
    fill="sample",
    boxplot_color="#3f3f3f",
    show_points=True,
    outlier_shape=1,
)

11.2 Fill splits the data as in ggplot2

plot = cl.boxplot(
    data,
    "pct_counts_in_top_50_genes",
    fill="leiden",
    boxplot_color="#3f3f3f",
    show_points=True,
    outlier_shape=1,
) + ggsize(1000, 400)

plot

11.3 Customize the plot

plot += scale_fill_brewer(palette="Set2") + scale_y_log2()
plot

11.4 Turn it into a interactive plot

Even if you did not create the plot with interactive = True you can still make it interactive with +ggtb() by lets_plot.

plot += ggtb()
plot
cl.versions()
cellestial: 0.2.0
scanpy: 1.10.4
anndata: 0.11.0
polars: 1.12.0