crested.pl.scatter.class_density

Contents

crested.pl.scatter.class_density#

crested.pl.scatter.class_density(adata, class_name=None, model_names=None, split='test', log_transform=False, exclude_zeros=True, density_indication=False, alpha=0.25, **kwargs)#

Plot a density scatter plot of predictions vs ground truth for specified models and class.

Parameters:
  • adata (AnnData) – AnnData object containing the data in X and predictions in layers.

  • class_name (Optional[str] (default: None)) – Name of the class in adata.obs_names. If None, plot is made for all the classes.

  • model_names (Optional[list[str]] (default: None)) – List of model names in adata.layers. If None, will create a plot per model in adata.layers.

  • split (str | None (default: 'test')) – ‘train’, ‘val’, ‘test’ subset or None. If None, will use all targets. If not None, expects a “split” column in adata.var.

  • log_transform (bool (default: False)) – Whether to log-transform the data before plotting. Default is False.

  • exclude_zeros (bool (default: True)) – Whether to exclude zero ground truth values from the plot. Default is True.

  • density_indication (bool (default: False)) – Whether to indicate density in the scatter plot. Default is False.

  • alpha (float (default: 0.25)) – Transparency of points in scatter plot. From 0 (transparent) to 1 (opaque).

  • kwargs – Additional arguments passed to render_plot() to control the final plot output. Please see render_plot() for details.

Return type:

Figure

Example

>>> crested.pl.scatter.class_density(
...     adata,
...     class_name="Astro",
...     model_names=["model1", "model2"],
...     split="test",
...     log_transform=True,
... )
../../../_images/scatter_class_density.png