10  violins

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

LetsPlot.setup_html()

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

10.1 Instead of a single key, violins expects a list (iterable) of keys.

10.1.1 it will split the plot into ncol columns

cl.violins(
    data,
    [
        "n_genes_by_counts",
        "pct_counts_in_top_100_genes",
        "log1p_total_counts_mt",
        "pct_counts_hb",
    ],
    ncol=2,
    fill="sample",
    show_points=False,
    layers=[scale_y_log10()],
)

10.2 Merge multiple plots into a single plot

You can simply set multi_panel=False to merge multiple plots into a single plot.

It is not suggested to use this option if the plots have extremely different scales.

cl.violins(
    data,
    [
        "n_genes_by_counts",
        "pct_counts_in_top_100_genes",
        "log1p_total_counts_mt",
        "pct_counts_hb",
    ],
    ncol=2,
    fill='sample',
    show_points=False,
    add_tooltips=["leiden"],
    layers=[scale_y_log10()],
    multi_panel=False,
    scale="width",
)+ggsize(800,600)
cl.versions()
cellestial: 0.6.0
scanpy: 1.10.4
anndata: 0.11.3
polars: 1.12.0