FACSPy.pl.diffmap

Contents

FACSPy.pl.diffmap#

FACSPy.pl.diffmap(adata, gate=None, layer=None, dimred='diffmap', figsize=(3, 3), return_dataframe=False, return_fig=False, ax=None, show=True, save=None, *args, **kwargs)#

Plots the diffusion embedding.

Parameters:
  • adata (AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channels

  • gate (Optional[str]) – The gate to be analyzed, called by the population name. This parameter has a default stored in fp.settings, but can be superseded by the user.

  • layer (Optional[str]) – The layer corresponding to the data matrix. Similar to the gate parameter, it has a default stored in fp.settings which can be overwritten by user input.

  • figsize (tuple[float, float]) – Contains the dimensions of the final figure as a tuple of two ints or floats.

  • return_dataframe (bool) – If set to True, returns the raw data that are used for plotting as a dataframe.

  • return_fig (bool) – If set to True, the figure is returned.

  • ax (Optional[Axes]) – A Axes created from matplotlib to plot into.

  • show (bool) – Whether to show the figure. Defaults to True.

  • save (Optional[str]) – Expects a file path including the file name. Saves the figure to the indicated path. Defaults to None.

  • *args – arguments ultimately passed to sc.pl.diffmap

  • **kwargs – arguments ultimately passed to sc.pl.diffmap

Return type:

Optional[Figure, Axes, DataFrame]]

Returns:

  • If show==False a Axes

  • If return_fig==True a Figure

  • If return_dataframe==True a DataFrame containing the data used for plotting

Examples

import FACSPy as fp

dataset = fp.mouse_lineages()

fp.settings.default_gate = "CD45+"
fp.settings.default_layer = "transformed"

fp.tl.pca(dataset)
fp.tl.neighbors(dataset)
fp.tl.leiden(dataset)
fp.tl.diffmap(dataset)

dataset.obsm["X_diffmap_CD45+_transformed"] = dataset.obsm["X_diffmap_CD45+_transformed"][:,1:]

fp.pl.diffmap(
    dataset,
    color = "B220",
    vmin = 0,
    vmax = 4
)
../_images/FACSPy-pl-diffmap-1.png