API#

Basic plots#

crosstab(sdata, xvar, yvar[, layer, ...])

Generates a cross-tabulation plot between two categorical variables from sdata.points.

histogram(sdata, x[, hue, layer, group_key, ...])

Plots histograms of a numeric variable with optional grouping and faceting.

pie(sdata, groupby[, layer, group_key, ...])

Generates pie charts showing the proportion of different categories for a specified categorical variable.

coupled_scatter(sdata[, layer, output_path, ...])

Plots a scatter plot of transcript locations and cell centroids, coloring the transcripts by a specific feature (e.g., distance to the closest cell) and optionally saving the plot to a file.

heatmap(data[, output_path, save, figsize, ...])

Generate a clustered heatmap from the given data and optionally save it to a file.

sorted_heatmap(celltype_by_feature[, ...])

Plots the heatmap of target cells by gene.

spatial_transcripts(sdata[, gene_key, ...])

Plots a scatter plot of genes with their estimated diffusion coefficient (D_estimated) on the x-axis and a statistical metric (e.g., KS statistic) on the y-axis.

uRNA quantification#

gene_metric_heatmap(sdata[, metrics, ...])

Creates a heatmap or clustered heatmap of gene metrics, with color differentiation for control probes and optional saving.

logfoldratio_over_noise(sdata[, ...])

Creates a violin plot comparing logfoldratio_over_noise values for controlvs non-control probes, and tests for significance using the specified test.

metric_scatter(sdata, x, y[, size, ...])

Creates a scatter plot of two specified metrics from a SpatialData object, highlighting control vs.

top_bottom_probes(sdata, metric[, top_n, ...])

Creates a horizontal bar plot showing the top and bottom genes based on a specified metric.

genes_over_noise(sdata, scores_by_genes[, ...])

Function that plots log fold change per gene over noise using a boxplot.

intra_extra_density(sdata, genes[, layer, ...])

Plots kernel density estimates (KDE) for the spatial distribution of intracellular and extracellular transcripts for a list of genes.

moranI_histogram(svg_df[, save, ...])

Plots the distribution of Moran's I scores from a DataFrame.

diffusion_results(sdata[, x_col, y_col, ...])

Styled diffusion scatter plot matching metric_scatter aesthetics.

spatial_inout_expression(sdata, gene[, ...])

Plots intracellular and extracellular expression of a selected gene.

Source, target and communication#

celltype_communication(sdata[, kind, ...])

Plot cell type-cell type interaction strength as a heatmap or chord diagram.

gene_communication(sdata[, kind, gene, ...])

Plot cell type-cell type interaction strength as a heatmap or chord diagram.

global_distribution_from_source(sdata[, ...])

Plots either (1) A clustermap of all genes' distance distributions, sorted by cluster, with row colors, (2) A collapsed clustermap showing the mean distribution per cluster, with color-coded labels.

distributions_by_cluster(sdata[, gene_key, ...])

Plots the average normalized distance distribution for each cluster, overlaid with the expected (theoretical) diffusion pattern from a Rayleigh distribution computed from the global data (purely diffusion-based).

gene_distribution_from_source(sdata, ...[, ...])

Plots the diffusion distribution of specified genes as subplots in a grid.

source_score_by_celltype(sdata[, gene_key, ...])

Plots a heatmap or clustered heatmap of source scores by cell type.

target_score_by_celltype(sdata[, gene_key, ...])

Plots a heatmap or clustered heatmap of target scores by cell type.

interactions_with_arrows(sdata[, layer, ...])

The function plots arrows from source to target cells based on transcript proximity, color-coding source and target cells, and transcript locations.

spatial_interactions(sdata[, layer, gene, ...])

Generates a scatter plot showing the positions of target cells, source cells, and extracellular RNA transcripts within a spatial omics dataset.

Factor analysis#

factors_in_cells(sdata[, layer, method, ...])

Plot factors from a specified layer in a Scanpy AnnData object.

rank_factor_genes_loadings(sdata, layer[, ...])

Plot top scoring genesex for each factor from NMF/LDA.

rank_factor_genes_loadings_matrixplot(sdata, ...)

Plot ranking of genes using a matrixplot based on factor loadings.

nmf_factors_exrna_cells_W(sdata[, ...])

Extracts the NMF (Non-negative Matrix Factorization) factors from the specified AnnData object within the spatial data (sdata) and creates spatial plots for each factor.

nmf_gene_contributions(sdata[, ...])

Extracts the NMF (Non-negative Matrix Factorization) gene loadings matrix from the specified AnnData object within the spatial data (sdata), filters genes based on their maximum loading value, and plots a heatmap of the filtered loadings.

paired_nmf_factors(sdata[, layer, ...])

Plots the spatial distribution of NMF factors for extracellular transcripts and cells.

apply_exrnaH_to_cellular_to_create_cellularW(...)

Transfers the gene loadings (H matrix) derived from extracellular RNA analysis to a cellular dataset.

Colormaps & palettes#

get_colormap([name])

Returns a continuous colormap for Matplotlib.

get_palette([name, n_colors])

Returns a discrete color palette as a list of hex codes.