Plotly figure tutorials for interactive omics
Each tutorial explains why interaction helps, which data and function produce the figure, how to substitute personal results, and how to interpret the output. The bundled datasets are deterministic simulations.
import pandas as pd
import bioviz_plotly as bp
01 Differential-expression dashboard
- Use when: users need to inspect effect size, abundance, adjusted evidence, and gene identity together.
- Data and code:
differential_expression.csvanddifferential_expression_dashboard. - Use your own data: pass gene ID, log2 fold change, mean expression, and adjusted p-value columns to the function and set declared thresholds.
- Interpret: hover supports feature lookup; volcano and MA panels provide complementary views. Upstream normalization, model fitting, shrinkage, and multiple testing are not performed by the plot.
- Explore: interactive HTML.
02 Subject-aware time course
- Use when: repeated observations need hoverable subject trajectories and group summaries.
- Data and code:
cytokine_timecourse.csvandcytokine_timecourse. - Use your own data: keep one row per subject-time-condition observation and pass the DataFrame to the function.
- Interpret: inspect timing, peaks, recovery, and heterogeneous responses. Use a repeated-measures model for inference.
- Explore: interactive HTML.
03 Microbiome composition
- Use when: taxa and exact within-sample percentages need hover inspection across many samples.
- Data and code:
microbiome_long.csvandmicrobiome_composition. - Use your own data: provide sample, group, taxon, and nonnegative abundance columns. Confirm whether the function should normalize counts within sample.
- Interpret: stacked bars are descriptive compositions. They do not solve compositional inference or establish differential abundance.
- Explore: interactive HTML.
04 CLR microbiome heatmap
- Use when: composition-aware sample profiles require exact hover values.
- Data and code:
microbiome_wide.csvandmicrobiome_clr_heatmap. - Use your own data: pass one sample per row with nonnegative taxon columns, and choose a documented positive pseudocount for zeros.
- Interpret: colors are centered-log-ratio coordinates, not proportions. Results depend on filtering and zero replacement.
- Explore: interactive HTML.
05 Pangenome PCA in 3D
- Use when: a third component and rotation help inspect overlapping genomes.
- Data and code:
pangenome_presence_absence.csvandpangenome_pca_3d. - Use your own data: provide one genome per row, one binary gene-family column per feature, and separate identifier and metadata columns.
- Interpret: rotation can expose or hide apparent separation. PCA remains an exploratory projection and does not prove population boundaries.
- Explore: interactive HTML.
06 Sequencing-QC dashboard
- Use when: readers need coordinated metric views and sample identifiers on demand without permanent labels.
- Data and code:
sequencing_qc.csvandsequencing_qc_dashboard. - Use your own data: use one row per library with the required depth, Q30, GC, mapping, duplication, batch, and sample columns.
- Interpret: hover and zoom identify libraries requiring review. Thresholds must be justified for the protocol and downstream analysis.
- Explore: interactive HTML.
07 Genome-wide Manhattan plot
- Use when: dense genome-wide results require zoom and variant identifiers in hover.
- Data and code:
variants.csvandvariant_manhattan. - Use your own data: provide chromosome, physical position, variant ID, and valid p-value columns. State genome build and significance threshold.
- Interpret: peaks locate supplied association evidence. Population structure, relatedness, linkage, quality control, and replication remain upstream scientific requirements.
- Explore: interactive HTML.
08 Expression distributions
- Use when: distribution shape, quartiles, and individual replicates should be inspected interactively.
- Data and code:
gene_expression.csvandexpression_violin. - Use your own data: pass a long table with gene, condition, replicate, and processed expression columns.
- Interpret: compare shape and variation, not only the center. A violin is a density estimate and is unreliable with very small sample sizes.
- Explore: interactive HTML.
09 Animated growth response
- Use when: temporal progression is itself the message and stable axes can be maintained.
- Data and code:
growth_curves.csvandanimated_growth_curve. - Use your own data: provide time, condition, replicate, and response fields. Sort time numerically before constructing animation frames.
- Interpret: animation reveals sequence but makes exact comparison harder. Accompany it with a static endpoint or full-trajectory view.
- Explore: interactive HTML.
10 Pathway hierarchy
- Use when: users need to navigate nested observed categories from broad biological processes to specific pathways.
- Data and code:
pathways.csvandpathway_sunburst. - Use your own data: provide parent-child category fields, labels, and nonnegative values with an internally consistent hierarchy.
- Interpret: sector area encodes supplied counts. A sunburst does not perform enrichment analysis and should not be described as pathway significance.
- Explore: interactive HTML.
Reproduce and publish
python scripts/generate_datasets.py
python scripts/build_gallery.py --html-only
MPLBACKEND=Agg python scripts/build_previews.py
python -m pytest
Use fig.write_html("my_figure.html") for a standalone interactive file and
fig.write_image("my_figure.svg") for a static publication artifact.