import cellestial as cl
import scanpy as sc
from lets_plot import *
LetsPlot.setup_html()
= sc.read("data/pbmc3k_pped.h5ad") data
1 Overview
Cellestial is an interactive single-cell plotting library.
1.1 Tooltips
By default, cellestial produces HTML plots with geoms
reveal tooltips when hovering.
= cl.dimensional(
plot ="umap", key="leiden", size=0.6, axis_type="arrow"
data, dimensions
) plot
dimensional
plot produces dimensionalilty reduction plots by taking dimensions
argument. Yet, the subset of plots pca
, umap
and tsne
are also available.
Also, the expression
plot is also a subset of dimensional
plot but it only works with genes.
1.2 Zooming and Paning
There are also zoomable and panable if specified.
= cl.dimensional(
plot
data,="umap",
dimensions="leiden",
key=0.6,
size=True,
interactive="arrow",
axis_type
) plot
Note that this functionality can be added via + ggtb()
layer of lets_plot.
1.3 High Customizability
Cellestial uses Lets-Plot, a ggplot2 impelementation in Pyton. As such, it allows adding or changing layers. Including color palettes, titles, labels, size etc., .
Here an example with switching color palette to hue
which is also the ggplot2 and Seurat defaults. Also, other theme()
based customizations are given as examples.
gggrid(
[+ scale_color_hue() + labs(title="Change color palette"),
plot
plot+ theme(legend_text=element_text(size=15))
+ labs(title="Change legend text size"),
plot+ theme(axis_title=element_blank())
+ labs(title="Remove axis titles"),
],=2,
ncol+ ggsize(1000, 800) )
Indeed, you can modify the size.
+= ggsize(500, 400)
plot plot
1.4 Multi-Plots
Multi-plots uses dimensional
plot and grids list of keys given.
While single-plot functions which generate a single-plot object, Multi-plot functions have plural names which provides predictable behaviors.
So, pca
becomes pcas
, umap
becomes umaps
, tsne
becomes tsnes
etc., for multi-plots.
= (
umap_grid
cl.umaps(
data,=["leiden", "HBD", "NEAT1", "IGKC"],
keys=2,
ncol=0.6,
size="#D2042D", # works with hex codes, rgb codes, and names (red, blue, etc.)
color_high
)+ ggsize(900, 700)
) umap_grid
cl.versions()
cellestial: 0.2.0
scanpy: 1.10.4
anndata: 0.11.0
polars: 1.12.0