agentsclimarketplace

Ggplot2 customization for statistical plots

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/ggplot2-customization-for-statistical-plots

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.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill ggplot2-customization-for-statistical-plots

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.2 KB, 971 tokens by cl100k_base, as published. Nobody here has run it

ggplot2-customization-for-statistical-plots

License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->

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)"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.