Plotting: pl#

The plotting module scanpy.pl largely parallels the tl.* and a few of the pp.* functions. For most tools and for some preprocessing functions, you’ll find a plotting function with the same name.

See Core plotting functions for an overview of how to use these functions.

Note

See the Settings section for all important plotting configurations.

Generic#

pl.scatter

Scatter plot along observations or variables axes.

pl.heatmap

Heatmap of the expression values of genes.

pl.dotplot

Makes a dot plot of the expression values of var_names.

pl.tracksplot

In this type of plot each var_name is plotted as a filled line plot where the y values correspond to the var_name values and x is each of the cells.

pl.violin

Violin plot.

pl.stacked_violin

Stacked violin plots.

pl.matrixplot

Creates a heatmap of the mean expression values per group of each var_names.

pl.clustermap

Hierarchically-clustered heatmap.

pl.ranking

Plot rankings.

pl.dendrogram

Plots a dendrogram of the categories defined in groupby.

Classes#

These classes allow fine tuning of visual parameters.

pl.DotPlot

Allows the visualization of two values that are encoded as dot size and color.

pl.MatrixPlot

Allows the visualization of values using a color map.

pl.StackedViolin

Stacked violin plots.

Preprocessing#

Methods for visualizing quality control and results of preprocessing functions.

pl.highest_expr_genes

Fraction of counts assigned to each gene over all cells.

pl.filter_genes_dispersion

Plot dispersions versus means for genes.

pl.highly_variable_genes

Plot dispersions or normalized variance versus means for genes.

pl.scrublet_score_distribution

Plot histogram of doublet scores for observed transcriptomes and simulated doublets.

Tools#

Methods that extract and visualize tool-specific annotation in an AnnData object. For any method in module tl, there is a method with the same name in pl.

PCA#

pl.pca

Scatter plot in PCA coordinates.

pl.pca_loadings

Rank genes according to contributions to PCs.

pl.pca_variance_ratio

Plot the variance ratio.

pl.pca_overview

Plot PCA results.

Embeddings#

pl.tsne

Scatter plot in tSNE basis.

pl.umap

Scatter plot in UMAP basis.

pl.diffmap

Scatter plot in Diffusion Map basis.

pl.draw_graph

Scatter plot in graph-drawing basis.

pl.spatial

Scatter plot in spatial coordinates.

pl.embedding

Scatter plot for user specified embedding basis (e.g. umap, pca, etc).

Compute densities on embeddings.

pl.embedding_density

Plot the density of cells in an embedding (per condition).

Branching trajectories and pseudotime, clustering#

Visualize clusters using one of the embedding methods passing color='louvain'.

pl.dpt_groups_pseudotime

Plot groups and pseudotime.

pl.dpt_timeseries

Heatmap of pseudotime series.

pl.paga

Plot the PAGA graph through thresholding low-connectivity edges.

pl.paga_path

Gene expression and annotation changes along paths in the abstracted graph.

pl.paga_compare

Scatter and PAGA graph side-by-side.

Marker genes#

pl.rank_genes_groups

Plot ranking of genes.

pl.rank_genes_groups_violin

Plot ranking of genes for all tested comparisons.

pl.rank_genes_groups_stacked_violin

Plot ranking of genes using stacked_violin plot (see stacked_violin())

pl.rank_genes_groups_heatmap

Plot ranking of genes using heatmap plot (see heatmap())

pl.rank_genes_groups_dotplot

Plot ranking of genes using dotplot plot (see dotplot())

pl.rank_genes_groups_matrixplot

Plot ranking of genes using matrixplot plot (see matrixplot())

pl.rank_genes_groups_tracksplot

Plot ranking of genes using heatmap plot (see heatmap())

Simulations#

pl.sim

Plot results of simulation.