, x=None, y=None, color=None, use_raw=None, layers=None, sort_order=True, alpha=None, basis=None, groups=None, components=None, projection='2d', legend_loc='right margin', legend_fontsize=None, legend_fontweight=None, legend_fontoutline=None, color_map=None, palette=None, frameon=None, right_margin=None, left_margin=None, size=None, title=None, show=None, save=None, ax=None)

Scatter plot along observations or variables axes.

Color the plot using annotations of observations (.obs), variables (.var) or expression of genes (.var_names).

adata : AnnDataAnnData

Annotated data matrix.

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

x coordinate.

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

y coordinate.

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

Keys for annotations of observations/cells or variables/genes, or a hex color specification, e.g., 'ann1', '#fe57a1', or ['ann1', 'ann2'].

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

Use raw attribute of adata if present.

layers : str, Collection[str], NoneUnion[str, Collection[str], None] (default: None)

Use the layers attribute of adata if present: specify the layer for x, y and color. If layers is a string, then it is expanded to (layers, layers, layers).

basis : {‘pca’, ‘tsne’, ‘umap’, ‘diffmap’, ‘draw_graph_fr’}, NoneOptional[Literal[‘pca’, ‘tsne’, ‘umap’, ‘diffmap’, ‘draw_graph_fr’]] (default: None)

String that denotes a plotting tool that computed coordinates.

sort_order : boolbool (default: True)

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

groups : str, Iterable[str], NoneUnion[str, Iterable[str], None] (default: None)

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

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

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

projection : {‘2d’, ‘3d’}Literal[‘2d’, ‘3d’] (default: '2d')

Projection of plot (default: '2d').

legend_loc : strstr (default: 'right margin')

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

legend_fontsize : int, float, {‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’}, NoneUnion[int, float, Literal[‘xx-small’, ‘x-small’, ‘small’, ‘medium’, ‘large’, ‘x-large’, ‘xx-large’], None] (default: None)

Numeric size in pt or string describing the size. See set_fontsize().

legend_fontweight : int, {‘light’, ‘normal’, ‘medium’, ‘semibold’, ‘bold’, ‘heavy’, ‘black’}, NoneUnion[int, Literal[‘light’, ‘normal’, ‘medium’, ‘semibold’, ‘bold’, ‘heavy’, ‘black’], None] (default: None)

Legend font weight. A numeric value in range 0-1000 or a string. Defaults to 'bold' if legend_loc == 'on data', otherwise to 'normal'. See set_fontweight().

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

Line width of the legend font outline in pt. Draws a white outline using the path effect withStroke.

size : int, float, NoneUnion[int, float, None] (default: None)

Point size. If None, is automatically computed as 120000 / n_cells. Can be a sequence containing the size for each cell. The order should be the same as in adata.obs. If img_key not None, size is the scaling factor for the spot size.

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

Color map to use for continous variables. Can be a name or a Colormap instance (e.g. "magma”, "viridis" or, see get_cmap(). If None, the value of mpl.rcParams["image.cmap"] is used. The default color_map can be set using set_figure_params().

palette : Cycler, ListedColormap, str, Tuple[float, …], Sequence[Union[str, Tuple[float, …]]], NoneUnion[Cycler, ListedColormap, str, Tuple[float, …], Sequence[Union[str, Tuple[float, …]]], None] (default: None)

Colors to use for plotting categorical annotation groups. The palette can be a valid ListedColormap name ('Set2', 'tab20', …), a Cycler object, or a sequence of matplotlib colors like ['red', '#ccdd11', (0.1, 0.2, 1)] (see is_color_like()). 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.

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

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

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

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


Key for image data, stored in adata.uns.


Coordinates to use for cropping the image (left, right, top, bottom).


Alpha value for image.


Plot Image in gray scale.

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

Show the plot, do not return axis.

save : str, bool, NoneUnion[str, bool, 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.


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