import cellestial as cl
import scanpy as sc
from lets_plot import *
LetsPlot.setup_html()
= sc.read("data/pbmc3k_mini.h5ad") data
2 scatter
2.1 A simple scatter plot
A scatter
plot is a type of plot that displays the relationship between two quantitative variables. The scatter
plot is useful for visualizing the relationship between two continuous variables.
= (
plot
cl.scatter(
data,="pct_counts_mt",
x="total_counts_ribo",
y="n_genes_by_counts",
aes_color=3,
size
)+ scale_y_log10()
+ ggsize(600, 400)
)
plot
2.2 Customizations
Add any layer you desire, from color palettes to size of the plot to theme components.
For example, you can simply modify or ‘ovewrite’ the color palette.
+ scale_color_continuous(low="blue", high="red") plot
or make the plot interactive. note that it is also possible to make it zoomable and panable by setting the interactive
argument to True
when calling the function.
+ ggtb()
plot # you can use the buttons from the toolbar to zoom in and out or move around the plot
and of course you can modify the theme componenents of the plot.
= (
plot
plot+ labs(x="PCM", y="TCR", title="TCR vs PCM") # modify labels
+ theme(
=element_text(size=18, color="#6f6f6f"), # modify axis titles
axis_title=element_text(
title="monospace", size=20, color="#3f3f3f", face="bold"
family# modify title elements
), =element_blank(), # remove axis lines
axis_line=element_blank(), # remove axis ticks
axis_ticks=element_text(size=16, face="italic"), # remove axis text
axis_text="bottom", # move legend to bottom
legend_position
)+ ggsize(700, 600)
+ ggtb()
) plot
cl.versions()
cellestial: 0.2.0
scanpy: 1.10.4
anndata: 0.11.0
polars: 1.12.0