scanpy.pl.pca_overview¶
-
scanpy.pl.
pca_overview
(adata, **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.
- Parameters
- 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 ofadata
if present.- sort_order
For continuous annotations used as color parameter, plot data points with higher values on top of others.
- groups
Restrict to a few categories in categorical observation annotation. The default is not to restrict to any groups.
- components
For instance,
['1,2', '2,3']
. To plot all available components usecomponents='all'
.- projection : {'2d', '3d'}, optional (default: '2d')
Projection of plot.
- legend_loc
Location of legend, either ‘on data’, ‘right margin’ or valid keywords for
matplotlib.legend
.- legend_fontsize
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
Linewidth of the legend font outline. This uses
matplotlib.patheffects
to draw a white outline around the legend text.- size
Point size. If
None
, is automatically computed.- color_map
Color map to use for continous variables. Anything that works for
cmap
argument ofpyplot.scatter
should work here (e.g."magma"
,"viridis"
,mpl.cm.cividis
). IfNone
value ofmpl.rcParams["image.cmap"]
is used.- palette
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. IfNone
,mpl.rcParams["axes.prop_cycle"]
is used unless the categorical variable already has colors stored inadata.uns["{var}_colors"]
. If provided, values ofadata.uns["{var}_colors"]
will be set by this palette.- frameon
Draw a frame around the scatter plot. Defaults to value set in
set_figure_params()
, defaults toTrue
.- ncols
Number of panels per row.
- wspace
Adjust the width of the space between multiple panels.
- hspace
Adjust the height of the space between multiple panels.
- title
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
Return the matplotlib figure.
- show : bool, optional (default:
None
) Show the plot, do not return axis.
- save :
bool
orstr
, optional (default:None
) If
True
or astr
, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.
- adata :