enrichplot
Dependencies & Environment
Package-intrinsic requirements from the Bioconductor landing page — reproduce in any R environment.
- Version: 1.32.0 · Bioconductor: 3.23 · R: ≥ 4.6
- Imports: aplot, DOSE, dplyr, enrichit, ggfun, ggnewscale, ggplot2, ggrepel, ggtangle, ggtree, GOSemSim, igraph, purrr, RColorBrewer, reshape2, rlang, scatterpie, tidydr, yulab.utils
- Install:
BiocManager::install("enrichplot")
When to Use
- Enrichment Visualization: Visualizing functional enrichment results (Over-Representation Analysis [ORA] or Gene Set Enrichment Analysis [GSEA]) generated by
clusterProfiler,DOSE,meshes, orReactomePA. - Network Plots: Creating advanced network plots (e.g.,
cnetplotto show gene-concept networks,emapplotfor enrichment map plots). - GSEA Running Scores: Generating publication-ready GSEA running score plots (
gseaplot2) showing the distribution of enrichment scores across ranked gene lists. - Functional Clustering: Visualizing functional similarities and clustering of enriched terms using tree plots (
treeplot) or heatplots (heatplot).
When NOT to Use
- For performing the actual enrichment calculations, use
clusterProfilerorfgseainstead becauseenrichplotis strictly a visualization package. - For generic, non-biological network visualizations, use
ggraphorigraphdirectly to avoid enrichment-specific object constraints.
Data Requirements
- Enrichment Result: An enrichment result object (typically of class
enrichResultorgseaResultfromclusterProfileror related packages). - Fold Changes: For gene-concept networks, a named vector of fold changes (numeric) is highly recommended to color gene nodes.
Key Parameters
- showCategory (5): Number of enriched terms/categories to display in the plot.
- color ("p.adjust"): Variable used to color nodes or bars (e.g., "pvalue", "p.adjust", "qvalue").
- layout ("kk"): Layout algorithm for network plots like
cnetplotoremapplot. - foldChange (NULL): Numeric vector of fold changes to color gene nodes in
cnetplotorheatplot. - geneSetID: Numeric index or character ID of the gene set to plot in
gseaplot2.
Best Practices
- Calculate Similarities: Calculate pairwise term similarities using
pairwise_termsim()before runningemapplot()ortreeplot(). - Identify Hub Genes: Use
cnetplotto identify hub genes that contribute to multiple enriched pathways. - Avoid Overcrowding: Adjust the
showCategoryparameter to avoid overcrowded plots when dealing with many enriched terms. - Customize with ggplot2: Leverage
ggplot2functions (e.g.,theme(),labs()) to customize the output plots since allenrichplotfigures are standard ggplot objects.
Common Pitfalls
- Missing Similarity Matrix: Running
emapplotortreeplotthrows an error about missing term similarity; fix this by runningx <- pairwise_termsim(x)on your enrichment object first. - Overlapping Labels: Node labels in network plots overlap and are unreadable; fix this by setting
cex_label_categoryor usingggrepeloptions if supported. - Mismatched Gene IDs: Gene names in
cnetplotare displayed as cryptic Entrez IDs; fix this by usingsetReadable()fromclusterProfilerto translate IDs to gene symbols before plotting.
Alternatives
- clusterProfiler: Contains basic built-in plotting functions (barplots, dotplots) but lacks advanced network visualizations.
- pathfindR: Offers active-subnetwork-oriented enrichment and visualization.
- enrichViewNet: Specifically designed for visualizing enrichment networks using interactive layouts.
Citations
- Yu, G. (2020). yulab-smu.top/biomedical-knowledge-mining-book/.
References
- Homepage: https://bioconductor.org/packages/enrichplot
- Vignette: https://bioconductor.org/packages/release/bioc/vignettes/enrichplot/inst/doc/enrichplot.html
Run this on BioMate
This skill is the knowledge layer — when, why, and how to use enrichplot. To run this analysis on your own data with managed compute, automated QC, and reproducible outputs, use BioMate — free to start.


