plot#

API pages include interactive (HTML) plots that would possibly not render correctly on a mobile device.

plot(data: AnnData | MuData, mapping: FeatureSpec | None = None, *, axis: Literal[0, 1] | None = None, variable_keys: Sequence[str] | None = None, observation_id_column: str = 'Barcode', variable_id_column: str = 'Variable', include_dimensions: bool | int = False) → PlotSpec#

Base plot (for plots without data wrangling).

Parameters:
  • data (AnnData | MuData) – The single-cell data object.

  • mapping (FeatureSpec | None, default None) – Aesthetic mappings for the plot, the result of aes().

  • axis ({0,1} | None, default None) – axis of the data, 0 for observations and 1 for variables.

  • variable_keys (Sequence[str] | None, default None) – Variable keys to add to the DataFrame. If None, no additional keys are added.

  • observation_id_column (str, default 'Barcode') – The name of the observations column.

  • variable_id_column (str, default 'Variable') – Name for the variables index column.

  • include_dimensions (bool | int, default False) – Whether to include dimensions in the DataFrame. Providing an integer will limit the number of dimensions to given number.

Returns:

PlotSpec – Base ggplot object.

Raises:

UnsupportedDataTypeError – If data is not a supported single-cell data object.

Examples

from ggrust import *

import cellestial as cl
import scanpy as sc

data = cl.datasets.pbmc3k()

p1 = (
    cl.plot(data, aes(x='cell_type_lvl1', y='n_genes'))
)
p1 # plot object without layers
-0.4 -0.2 0 0.2 0.4 -0.4 -0.2 0 0.2 0.4 x y
from ggrust import *

import cellestial as cl
import scanpy as sc

data = cl.datasets.pbmc3k()

p2 = (
    cl.plot(data, aes(x='cell_type_lvl1', y='n_genes'))
    + geom_violin(aes(fill='cell_type_lvl1'), scale='width')
    + geom_boxplot(width=0.2,outlier_size=0)
    + scale_fill_viridis()
)
p2
Lymphocytes Monocytes Erythroid B Cells 0 1,000 2,000 3,000 4,000 5,000 6,000 7,000 8,000 cell_type_lvl1 n_genes cell_type_lvl1 Lymphocytes Monocytes Erythroid B Cells