, **params)

Plot PCA results.

The parameters are the ones of the scatter plot. Call pca_ranking separately if you want to change the default settings.

adata : AnnData

Annotated data matrix.

color : string or list of strings, optional (default: None)

Keys for observation/cell annotation either as list ["ann1", "ann2"] or string "ann1,ann2,...".

use_raw : bool, optional (default: True)

Use raw attribute of adata if present.


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


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


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

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

Projection of plot.


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


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'].


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


Point size. If None, is automatically computed.


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


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.


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


Number of panels per row.


Adjust the width of the space between multiple panels.


Adjust the height of the space between multiple panels.


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 the matplotlib figure.

show : bool, optional (default: None)

Show the plot, do not return axis.

save : bool or str, optional (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’}.