scanpy.pl.diffmap

scanpy.pl.diffmap(adata, basis, *, color=None, gene_symbols=None, use_raw=None, sort_order=True, edges=False, edges_width=0.1, edges_color='grey', arrows=False, arrows_kwds=None, groups=None, components=None, layer=None, projection='2d', color_map=None, palette=None, size=None, frameon=None, legend_fontsize=None, legend_fontweight='bold', legend_loc='right margin', legend_fontoutline=None, ncols=4, hspace=0.25, wspace=None, title=None, show=None, save=None, ax=None, return_fig=None, **kwargs)

Scatter plot in Diffusion Map basis.

Parameters
adata : AnnDataAnnData

Annotated data matrix.

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

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

gene_symbols : str, NoneOptional[str] (default: None)

Column name in .var DataFrame that stores gene symbols. By default var_names refer to the index column of the .var DataFrame. Setting this option allows alternative names to be used.

use_raw : bool, NoneOptional[bool] (default: None)

Use .raw attribute of adata for coloring with gene expression. If None, defaults to True if layer isn’t provided and adata.raw is present.

layer : str, NoneOptional[str] (default: None)

Name of the AnnData object layer that wants to be plotted. By default adata.raw.X is plotted. If use_raw=False is set, then adata.X is plotted. If layer is set to a valid layer name, then the layer is plotted. layer takes precedence over use_raw.

sort_order : boolbool (default: True)

For continuous annotations used as color parameter, plot data points with higher values on top of others.

groups : str, NoneOptional[str] (default: None)

Restrict to a few categories in categorical observation annotation. The default is not to restrict to any groups.

components : str, Sequence[str], NoneUnion[str, Sequence[str], None] (default: None)

For instance, ['1,2', '2,3']. To plot all available components use components='all'.

projection : {'2d', '3d'}, optional (default: '2d')

Projection of plot.

legend_loc : strstr (default: 'right margin')

Location of legend, either ‘on data’, ‘right margin’ or valid keywords for matplotlib.legend.

legend_fontsize : int, NoneOptional[int] (default: None)

Legend font size.

legend_fontweight : {‘normal’, ‘bold’, …}, optional (default: None)

Legend font weight. Defaults to ‘bold’ if legend_loc == 'on data', otherwise to ‘normal’. Available are ['light', 'normal', 'medium', 'semibold', 'bold', 'heavy', 'black'].

legend_fontoutline : int, NoneOptional[int] (default: None)

Linewidth of the legend font outline. This uses matplotlib.patheffects to draw a white outline around the legend text.

size : float, NoneOptional[float] (default: None)

Point size. If None, is automatically computed.

color_map : Colormap, str, NoneUnion[Colormap, str, None] (default: None)

Color map to use for continous variables. Anything that works for cmap argument of pyplot.scatter should work here (e.g. "magma", "viridis", mpl.cm.cividis). If None value of mpl.rcParams["image.cmap"] is used.

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

Colors to use for plotting categorical annotation groups. The palette can be a valid matplotlib.pyplot.colormap name like 'Set2' or 'tab20', a list of colors like ['red', '#ccdd11', (0.1, 0.2, 1)] or a Cycler object. If None, mpl.rcParams["axes.prop_cycle"] is used unless the categorical variable already has colors stored in adata.uns["{var}_colors"]. If provided, values of adata.uns["{var}_colors"] will be set by this palette.

frameon : bool, NoneOptional[bool] (default: None)

Draw a frame around the scatter plot. Defaults to value set in set_figure_params(), defaults to True.

ncols : intint (default: 4)

Number of panels per row.

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

Adjust the width of the space between multiple panels.

hspace : floatfloat (default: 0.25)

Adjust the height of the space between multiple panels.

title : str, Sequence[str], NoneUnion[str, Sequence[str], None] (default: None)

Provide title for panels either as string or list of strings, e.g. ['title1', 'title2', ...].

kwargs : further keyword arguments, optional

Arguments to pass to matplotlib.pyplot.scatter(), for instance: the maximum and minimum values (e.g. vmin=-2, vmax=5).

return_fig : bool, NoneOptional[bool] (default: None)

Return the matplotlib figure.

show : bool, NoneOptional[bool] (default: None)

Show the plot, do not return axis.

save : bool, str, NoneUnion[bool, str, None] (default: None)

If True or a str, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.

ax : Axes, NoneOptional[Axes] (default: None)

A matplotlib axes object. Only works if plotting a single component.

Return type

Figure, Axes, NoneUnion[Figure, Axes, None]

Returns

If show==False a Axes or a list of it.