Use when when a statistical analysis function (e.g., random_forest or
Scanned 9/12/2026
Install to Claude Code
npx -y skills add HolobiomicsLab/asb-skill-collections --skill ggplot2-customization-for-statistical-plots --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Ggplot2 Customization For Statistical Plots?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/holobiomicslab-ggplot2-customization-for-statistical-plots)More formats (shields.io, HTML) on the badges page.
---
name: ggplot2-customization-for-statistical-plots
description: Use when when a statistical analysis function (e.g., random_forest or
PCA_plot from Omu) returns a ggplot2 object and you need to adjust visual presentation—such
as removing gridlines, applying a clean background theme (e.
license: CC-BY-4.0
metadata:
edam_operation: http://edamontology.org/operation_0337
edam_topics:
- http://edamontology.org/topic_0091
- http://edamontology.org/topic_3678
tools:
- R
- ggplot2
- Omu (plot_variable_importance, PCA_plot, plot_bar)
license_tier: open
provenance_tier: literature
derived_from:
- doi: 10.1128/mra.00129-19
title: omu metabolomics count data tool
evidence_spans:
- Omu is an R package that enables rapid analysis of Metabolomics data sets
- The figure is a ggplot2 object, so it is compatible with any ggplot2 themes
- The figure is a ggplot2 object, so it is compatible with any ggplot2 themes you
wish to use to edit the appearance
claims: []
provenance:
collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v2
assembled_by: scripts/collect_metabolomics_collection.py
sources:
- build: coll_omu_metabolomics_count_data_tool_cq
doi: 10.1128/mra.00129-19
title: omu metabolomics count data tool
dedup_kept_from: coll_omu_metabolomics_count_data_tool_cq
schema_version: 0.2.0
attribution:
generator: AgenticScienceBuilder
original_doi: 10.1128/mra.00129-19
all_source_dois:
- 10.1128/mra.00129-19
zenodo_doi: 10.5281/zenodo.20794027
curators: []
promoter: Louis-Félix Nothias
sponsor: CNRS & Université Côte d'Azur
---
# ggplot2-customization-for-statistical-plots
## Summary
Customize ggplot2 statistical visualizations (e.g., variable importance plots from random forest models) by layering ggplot2 themes and removing default visual elements to produce publication-ready figures. This skill is essential when wrapper functions return ggplot2 objects that require aesthetic refinement without altering the underlying data or statistical computation.
## When to use
When a statistical analysis function (e.g., random_forest or PCA_plot from Omu) returns a ggplot2 object and you need to adjust visual presentation—such as removing gridlines, applying a clean background theme (e.g., theme_bw), or aligning the figure with journal or presentation standards—without re-computing the statistical result.
## When NOT to use
- Input is a base R plot (not a ggplot2 object); use base R par() or plot() parameters instead.
- You need to modify the underlying statistical computation or data; use filter_steps or workflow steps to transform inputs before passing to the visualization function.
- The visualization function does not return a ggplot2 object; consult the function documentation or apply tool-specific customization methods.
## Inputs
- ggplot2 object (e.g., from plot_variable_importance, PCA_plot, or plot_bar functions)
- Optionally: ggplot2 theme name or custom theme definition
## Outputs
- Customized ggplot2 object suitable for publication or presentation
- Rendered figure (PNG, PDF, or display)
## How to apply
After obtaining a ggplot2 object from a statistical wrapper (e.g., plot_variable_importance output), apply ggplot2 theme functions to modify the plot's appearance. Use theme_bw() or other ggplot2 built-in themes to standardize the background and axis styling. Remove unwanted visual elements—such as major or minor gridlines—using theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()). Stack these modifications as additional layers using the + operator, which does not alter the statistical content or data representation, only the rendering. Test the final figure visually to ensure clarity and alignment with publication or presentation goals.
## Related tools
- **ggplot2** (Core graphics library providing theme functions, element_blank(), and the + operator for layering aesthetic customizations onto statistical plot objects)
- **Omu (plot_variable_importance, PCA_plot, plot_bar)** (Wrapper functions that return ggplot2 objects as input to this customization skill) — https://github.com/connor-reid-tiffany/Omu
## Examples
```
# After obtaining a random forest plot from Omu:
rf_plot <- plot_variable_importance(rf_model)
customized_plot <- rf_plot + theme_bw() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
print(customized_plot)
```
## Evaluation signals
- The returned object is still a valid ggplot2 object (class 'gg' and 'ggplot'); verify using class(plot_object).
- Visual inspection confirms that gridlines are removed or themes are applied as intended without altering axis labels, legends, or statistical annotations.
- The customized plot renders without errors and can be saved to disk using ggsave() or exported to publication formats (PNG, PDF).
- Statistical content (e.g., variable importance rankings, PC loadings, bar heights) remains identical to the pre-customization version; only visual styling has changed.
- The plot meets journal or presentation style guidelines (e.g., black-and-white theme, no gridlines, readable font sizes).
## Limitations
- ggplot2 customization does not alter the underlying statistical computation; if the statistical result is incorrect, theme modifications alone cannot fix it.
- Theme and element functions are specific to ggplot2 syntax; base R plots or plots from other libraries (e.g., plotly, lattice) require different customization approaches.
- Over-customization (e.g., removing all gridlines and axis labels) may reduce clarity; balance aesthetics with readability.
- The article does not document specific theme recommendations or best practices for different metabolomics visualization types beyond the example of theme_bw() and gridline removal.
## Evidence
- [other] The figure is a ggplot2 object, so it is compatible with any ggplot2 themes: "The figure is a ggplot2 object, so it is compatible with any ggplot2 themes"
- [other] customize with ggplot2 themes as desired (e.g., theme_bw, remove gridlines): "customize with ggplot2 themes as desired (e.g., theme_bw, remove gridlines)"
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!