API#

Basic plots#

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

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

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

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

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

Generate pie charts of the proportion of each category of groupby.

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

Plot transcript locations and cell centroids, coloring transcripts by a chosen feature.

point_metric_comparison(sdata[, points_key, ...])

Plot a joint scatter/KDE comparison of two point-level metrics, colored by a third variable.

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[, ...])

Plot a heatmap of features by cell type, sorted by each feature's dominant cell type.

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

Plot spatial transcripts colored by a grouping variable, overlaid on cell boundaries.

uRNA quantification#

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

Plot a heatmap or clustered heatmap of per-gene metrics.

logfoldratio_over_noise(sdata[, ...])

Plot a violin plot comparing logfoldratio_over_noise for control vs non-control probes.

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

Plot a scatter plot of two metrics from sdata["xrna_metadata"].var.

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

Plot a horizontal bar chart of the top and bottom genes for a metric.

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

Plot the log fold change per gene over noise as a boxplot grouped by codeword category.

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

Plot KDEs of the spatial distribution of intracellular and extracellular transcripts for a list of genes.

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

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

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

Scatter plot of two diffusion metrics per probe, colored by control-probe status.

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

Plot intracellular and extracellular expression of a selected gene side by side.

Source, target and communication#

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

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

celltype_contact_matrix(mat[, sdata, kind, ...])

Plot a cell type x cell type contact matrix as a heatmap or chord diagram.

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

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

global_distribution_from_source(sdata[, ...])

Plot gene distance distributions, optionally grouped by cluster.

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

Plot the average normalized distance distribution for each cluster.

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

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

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

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

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

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

spatial_transcripts_source(sdata[, ...])

Plot transcripts colored by intracellular and extracellular source cell type, overlaid on cell boundaries.

urna_vs_source_score(sdata[, y_var, ...])

Plot a per-gene Y-axis variable from xrna_metadata.var against the mean source score.

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

Plot arrows from source to target cells based on transcript proximity for a gene.

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

Plot the positions of target cells, source cells, and extracellular RNA transcripts for a gene.

Factor analysis#

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

Plot per-cell factor loadings from a specified table, grouped by cell type.

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

Plot top scoring genes 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[, ...])

Plot the spatial distribution of each NMF factor for cells.

nmf_gene_contributions(sdata[, ...])

Plot a heatmap of NMF gene loadings, filtered to genes with a high maximum loading.

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

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

apply_exrnaH_to_cellular_to_create_cellularW(...)

Transfer NMF gene loadings from an extracellular RNA dataset to a cellular dataset.

Colormaps & palettes#

get_colormap([name])

Return a continuous colormap for Matplotlib.

get_palette([name, n_colors])

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