scmagnify.plotting.trendplot

Contents

scmagnify.plotting.trendplot#

scmagnify.plotting.trendplot(data, var_dict, sortby='pseudotime', palette='tab10', tkey_cmap='Spectral_r', col_color=None, smooth_method='gam', normalize=True, mask=0.05, n_convolve=5, n_splines=10, n_deg=3, show_stds=True, label_centroid=False, swap_x=False, show_tkey=True, figsize=None, dpi=300, nrows=1, ncols=1, wspace=0.4, hspace=None, sharex=False, sharey=False, context='notebook', default_context=None, theme='ticks', font_scale=1, title=None, ax=None, show=True, save=None, **kwargs)#

Plot variable trends along a sorted dimension (e.g., pseudotime).

Parameters:
  • data (AnnData | MuData | GRNMuData) – Single cell data object. Can be an anndata.AnnData, mudata.MuData, scmagnify.GRNMuData

  • var_dict (dict[str, str | list[tuple[str, str]]]) – Mapping variable -> [(modality, layer)] or list of modalities.

  • sortby (str (default: 'pseudotime')) – Observation key defining the ordering (pseudotime or similar).

  • palette (str | list[str] | None (default: 'tab10')) – Color palette name, list, or dictionary. See seaborn.color_palette().

  • tkey_cmap (str (default: 'Spectral_r')) – Colormap for the sortby key color bar.

  • col_color (Union[str, list[str], None] (default: None)) – Observation key(s) to color the background of the plot.

  • smooth_method (Literal['gam', 'convolve', 'polyfit', 'none'] (default: 'gam')) – Method used to smooth trends/values.

  • normalize (bool (default: True)) – Normalize values before plotting.

  • mask (float (default: 0.05)) – Proportion of cells to mask at both ends of the pseudotime_bins.

  • n_convolve (int (default: 5)) – Kernel size for convolution along sorted axis.

  • n_splines (int (default: 10)) – Number of splines for GAM smoothing.

  • n_deg (int (default: 3)) – Polynomial degree for polyfit smoothing.

  • show_stds (bool (default: True)) – Show standard deviations as shaded area around the trend line. Only the gam method

  • label_centroid (bool (default: False)) – Label the centroid of each trend line with a dashed vertical line.

  • swap_x (bool (default: False)) – Swap the x-axis direction.

  • show_tkey (bool (default: True)) – Show a color bar for the sortby key.

  • context (str | None (default: 'notebook')) – Seaborn context, e.g., ‘notebook’, ‘paper’. See seaborn.set_context().

  • default_context (Optional[dict] (default: None)) – If True, reset to default seaborn context before plotting.

  • theme (str | None (default: 'ticks')) – Theme name or rcParams overrides. See seaborn.set_theme().

  • font_scale (float | None (default: 1)) – Scale factor applied to fonts for the plot. See seaborn.set_context().

  • show (bool (default: True)) – Whether to display the figure. If None, the figure will be shown by default.

  • save (Optional[str] (default: None)) – Whether to save the figure. If True, the figure is saved to a file using the writekey. If a str is provided, it is used as the filename, potentially overriding other settings. If None or False, the figure is not saved.

  • **kwargs – Additional keyword arguments passed to seaborn.lineplot().

  • figsize (tuple | None)

  • dpi (int)

  • nrows (int | None)

  • ncols (int | None)

  • wspace (float | None)

  • hspace (float | None)

  • sharex (bool | None)

  • sharey (bool | None)

  • title (str | None)

  • ax (Axes | None)

Return type:

Axes

Returns:

matplotlib.axes.Axes Axis containing the plot (returned when show is False).