FACSPy.pl.pca#
- FACSPy.pl.pca(adata, gate=None, layer=None, figsize=(3, 3), return_dataframe=False, return_fig=False, ax=None, show=True, save=None, *args, **kwargs)#
Plots the PCA embedding.
- Parameters:
adata (
AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channelsgate (
Optional[str]) – The gate to be analyzed, called by the population name. This parameter has a default stored in fp.settings, but can be superseded by the user.layer (
Optional[str]) – The layer corresponding to the data matrix. Similar to the gate parameter, it has a default stored in fp.settings which can be overwritten by user input.figsize (
tuple[float,float]) – Contains the dimensions of the final figure as a tuple of two ints or floats.return_dataframe (
bool) – If set to True, returns the raw data that are used for plotting as a dataframe.return_fig (
bool) – If set to True, the figure is returned.ax (
Optional[Axes]) – AAxescreated from matplotlib to plot into.show (
bool) – Whether to show the figure. Defaults to True.save (
Optional[str]) – Expects a file path including the file name. Saves the figure to the indicated path. Defaults to None.*args – arguments ultimately passed to sc.pl.pca
**kwargs – arguments ultimately passed to sc.pl.pca
- Return type:
Optional[Figure,Axes,DataFrame]]- Returns:
If show==False a
AxesIf return_fig==True a
FigureIf return_dataframe==True a
DataFramecontaining the data used for plotting
Examples
import FACSPy as fp dataset = fp.mouse_lineages() fp.settings.default_gate = "CD45+" fp.settings.default_layer = "transformed" fp.tl.pca(dataset) fp.pl.pca( dataset, color = "B220", vmin = 0, vmax = 4 )