, basis, *, color=None, panel_size=(4, 4), palette=None, legend_loc='right margin', ax=None, ncols=3, show=False, hspace=0.25, wspace=None, **kwargs)

A customized wrapper to the function.

The differences to the scanpy embedding function are:
  • allows to specify a panel_size

  • Allows to specify a different basis, legend_loc and palette for each panel. The number of panels is defined by the color parameter.

  • Use a patched version for adding “on data” labels. The original raises a flood of warnings when coords are nan.

  • For columns with many categories, cycles through colors instead of reverting to grey

  • allows to specify axes, even if multiple colors are set.

adata : AnnData

annotated data matrix

basis : str

embedding to plot. Get the coordinates from the “X_{basis}” key in adata.obsm. This can be a list of the same length as color to specify different bases for each panel.

color : Sequence[str] | str | NoneUnion[Sequence[str], str, None] (default: None)

Keys for annotations of observations/cells or variables/genes, e.g., 'ann1' or ['ann1', 'ann2'].

panel_size : Tuple[float, float] (default: (4, 4))

Size tuple (width, height) of a single panel in inches

palette : str | Cycler | Sequence[str] | Sequence[Cycler] | NoneUnion[str, Cycler, Sequence[str], Sequence[Cycler], None] (default: None)

Colors to use for plotting categorical annotation groups. The palette can be a valid ListedColormap name ('Set2', 'tab20', …) or a Cycler object. It is possible to specify a list of the same size as color to choose a different color map for each panel.

legend_loc : str (default: 'right margin')

Location of legend, either 'on data', 'right margin' or a valid keyword for the loc parameter of Legend.

ax : Axes | Sequence[Axes] | NoneUnion[Axes, Sequence[Axes], None] (default: None)

A matplotlib axes object or a list with the same length as color thereof.

ncols : int (default: 3)

Number of columns for multi-panel plots

show : bool | NoneOptional[bool] (default: False)

If True, show the firgure. If false, return a list of Axes objects

wspace : float | NoneOptional[float] (default: None)

Adjust the width of the space between multiple panels.

hspace : float (default: 0.25)

Adjust the height of the space between multiple panels.


Arguments to pass to

Return type

None | Sequence[Axes]Optional[Sequence[Axes]]


axes A list of axes objects, containing one element for each color, or None if show == True.