ridge#
- ridge(data: AnnData, key: str, *, group_by: str | None = None, scale: float = 2.0, mapping: FeatureSpec | None = None, axis: Literal[0, 1] | None = None, threshold: float | None = None, add_keys: Sequence[str] | str | None = None, tooltips: Literal['none'] | Sequence[str] | FeatureSpec | None = None, observations_name: str = 'Barcode', variables_name: str = 'Variable', interactive: bool = False, **geom_kwargs) PlotSpec#
Ridge Plot.
- Parameters:
data (
AnnData) – The AnnData object of the single cell data.key (
str) – The key to get the values (numerical). e.g., ‘total_counts’ or a gene name.group_by (
str) – The key to group the ridges by (categorical). e.g., ‘cell_type’ or ‘leiden’.scale (
float, default2.0) – Scaling factor for the height of the ridges.mapping (
FeatureSpec | None, defaultNone) – Additional aesthetic mappings for the plot, the result of aes().axis (
{0,1}| None, defaultNone) – axis of the data, 0 for observations and 1 for variables.threshold (
float | None, defaultNone) – If provided, filters out rows where the value column is below the threshold.add_keys (
Sequence[str] | str | None, defaultNone) – Additional keys to include in the dataframe.tooltips (
{'none'}| Sequence[str] | FeatureSpec | None, defaultNone) – Tooltips to show when hovering over the geom. Accepts Sequence[str] or result of layer_tooltips() for more complex tooltips. Use ‘none’ to disable tooltips.observations_name (
str, default'Barcode') – The name to give to barcode (or index) column in the dataframe.variables_name (
str, default'Variable') – The name to give to variable index column in the dataframe.interactive (
bool, defaultFalse) – Whether to make the plot interactive.**geom_kwargs – Additional parameters for the geom_area_ridges layer. For more information on geom_area_ridges parameters, see: https://lets-plot.org/python/pages/api/lets_plot.geom_area_ridges.html
- Returns:
PlotSpec– Ridge plot.
Examples
import cellestial as cl import scanpy as sc from lets_plot import * data = sc.read_h5ad('data/pbmc3k_pped.h5ad') ridge = ( cl.ridge( data, key="B2M", group_by="cell_type_lvl1", ) ) ridge
Customize the geom.
ridge = ( cl.ridge( data, key="B2M", group_by="cell_type_lvl1", alpha=0.7, color="#1f1f1f", ) ) ridge