Skip to content

Visualization Overview

msmu._plotting wraps Plotly to provide ready-made QC and exploratory plots for MuData objects. The module is structured around data preparation helpers and lightweight plot wrappers so you can compose figures with consistent defaults while still passing Plotly kwargs to tweak layout.

Common parameters and behaviors

  • mdata: required MuData containing the modality to plot.
  • modality: required for plot_id, plot_intensity and plot_missingness; elsewhere it defaults to the level the plot is normally read at (psm for plot_var, protein for plot_pca, plot_umap, plot_correlation and plot_upset).
  • groupby: observation column used to split traces/groups (e.g., filename, condition). If omitted, falls back to obs_column.
  • obs_column: observation column used for labeling/group resolution; all elements should be unique. If omitted or no column exists, creates __obs_idx__ column from the index of obs
  • colorby: optional obs column for coloring; only applied when groupby equals obs_column.
  • ptype: plot style selector (hist, box, vln, etc.).
  • layer: optional; plot a layer instead of .X (plot_id, plot_intensity, plot_missingness, plot_upset).
  • template: optional Plotly template, "msmu" by default (plot_id, plot_intensity, plot_pca, plot_umap).
  • **kwargs: forwarded to go.Figure.update_layout for per-plot overrides.

Per-plot optional arguments:

  • bins: histogram bin count for plot_intensity and plot_var.
  • pcs: which principal components to draw in plot_pca, default (1, 2).
  • key: .obsm key holding the embedding, default X_pca / X_umap.
  • subset, subset_column: restrict plot_upset to one group of samples — it keeps the observations whose subset_column value in .obs equals subset.

Example

Uszkoreit, J., Barkovits, K., Pacharra, S., Pfeiffer, K., Steinbach, S., Marcus, K., & Eisenacher, M. (2022). Dataset containing physiological amounts of spike-in proteins into murine C2C12 background as a ground truth quantitative LC-MS/MS reference. Data in Brief, 43, 108435.

mdata.obs

set sample_id sample_name condition replicate
S1 QExHF04026 G1-1 G1 1
S1 QExHF04028 G2-1 G2 1
S1 QExHF04030 G3-1 G3 1
S1 QExHF04032 G4-1 G4 1
S1 QExHF04034 G5-1 G5 1
S1 QExHF04036 G1-2 G1 2
S1 QExHF04038 G2-2 G2 2
S1 QExHF04040 G3-2 G3 2
S1 QExHF04042 G4-2 G4 2
S1 QExHF04044 G5-2 G5 2
S1 QExHF04046 G1-3 G1 3
S1 QExHF04048 G2-3 G2 3
S1 QExHF04050 G3-3 G3 3
S1 QExHF04052 G4-3 G4 3
S1 QExHF04054 G5-3 G5 3

plot_id

mm.pl.plot_id(mdata, "protein", groupby="sample_name")

mm.pl.plot_id(mdata, "protein", groupby="condition")

plot_intensity

mm.pl.plot_intensity(mdata, "protein", groupby="sample_name", ptype="hist")

plot_missingness

mm.pl.plot_missingness(mdata, "protein")

plot_var

mm.pl.plot_var(mdata, "psm", groupby="sample_name", var_column="charge", ptype="stacked_bar")

mm.pl.plot_var(mdata, "psm", groupby="sample_name", var_column="peptide_length", ptype="vln")

plot_pca & plot_umap

mm.pl.plot_pca(mdata, "protein", groupby="condition")

plot_pca(..., key="X_pca") expects: - coordinates in mdata[modality].obsm[key] - PCA variance metadata in mdata[modality].uns[key]["variance_ratio"]

plot_umap(..., key="X_umap") expects: - coordinates in mdata[modality].obsm[key]

plot_correlation

mm.pl.plot_correlation(mdata, "protein")

plot_upset

mm.pl.plot_upset(mdata, "protein", groupby="condition")