gedi2py.plotting.embedding¶
- gedi2py.plotting.embedding(adata, *, basis='X_gedi_umap', color=None, layer=None, size=None, alpha=1.0, title=None, legend_loc='right margin', legend_fontsize=10, cmap='viridis', palette=None, frameon=False, ncols=4, wspace=0.4, show=None, save=None, ax=None, return_fig=False, **kwargs)[source]¶
Plot GEDI embedding colored by various attributes.
- Parameters:
adata (
AnnData) – Annotated data matrix.basis (
str, default:'X_gedi_umap') – Key inadata.obsmfor the embedding coordinates. Defaults toX_gedi_umap.color (
Union[str,Sequence[str],None], default:None) – Key(s) for annotation inadata.obsor gene names to color by. Can be a single key or a list of keys.layer (
str|None, default:None) – Layer to use for gene expression values.size (
float|None, default:None) – Point size. IfNone, automatically determined.alpha (
float, default:1.0) – Point transparency (0-1).title (
Union[str,Sequence[str],None], default:None) – Panel title(s). IfNone, uses thecolorkey(s).legend_loc (
str, default:'right margin') – Location of the legend. Options:'right margin','on data','best','upper right', etc.legend_fontsize (
int|float, default:10) – Font size for legend text.cmap (
str, default:'viridis') – Colormap for continuous variables.palette (
Union[str,Sequence[str],None], default:None) – Color palette for categorical variables.frameon (
bool, default:False) – Whether to show axis frame.ncols (
int, default:4) – Number of columns for multi-panel plots.wspace (
float, default:0.4) – Width space between panels.show (
bool|None, default:None) – IfTrue, show the figure. IfNone, defaults toTrueunlesssaveis specified.ax (
Axes|None, default:None) – Pre-existing axes for the plot. Only valid whencoloris a single key.return_fig (
bool, default:False) – IfTrue, return the figure object.**kwargs – Additional arguments passed to
matplotlib.pyplot.scatter.
- Returns:
If
return_fig=True: Returns the Figure objectIf
axis provided: Returns the Axes objectOtherwise: Returns
None
- Return type:
Depending on ``return_fig``andax
Examples
>>> import gedi2py as gd >>> gd.tl.gedi(adata, batch_key="sample", n_latent=10) >>> gd.tl.umap(adata) >>> gd.pl.embedding(adata, color="cell_type") >>> gd.pl.embedding(adata, color=["batch", "cell_type", "total_counts"])