Learn R Programming

GGenemy

Enemy of Bad Practices in Data Visualization

GGenemy is an R package that audits your ggplot2 visualizations for accessibility issues, misleading practices, and readability problems. Think of it as a linter for your data visualizations.

Why GGenemy?

Data visualizations can inadvertently mislead or exclude audiences through:

  • Poor color choices that are invisible to colorblind users (~8% of males)
  • Misleading scales like truncated axes or dual y-axes
  • Readability issues like tiny text or overlapping labels
  • Accessibility barriers that make charts hard to interpret

GGenemy catches these issues automatically and suggests fixes.

Installation

# Install from CRAN (coming soon)
install.packages("GGenemy")

# Or install development version from GitHub:
# install.packages("devtools")
devtools::install_github("andytai7/GGenemy")

Quick Start

library(GGenemy)
library(ggplot2)

# Create a plot with some issues
p <- ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
  geom_point() +
  scale_color_manual(values = c("red", "green", "blue"))

# Run comprehensive audit
report <- gg_audit(p)
print(report)

Key Features

Comprehensive Auditing

# Check everything
gg_audit(your_plot)

# Check specific aspects
gg_audit(your_plot, checks = c("color", "scales"))

Color Accessibility

Detects problematic color combinations and suggests colorblind-safe alternatives:

gg_audit_color(your_plot)

Colorblind Simulation

See how your plot appears to colorblind users:

# Simulate different types of color vision deficiency
gg_simulate_cvd(your_plot, type = "deutan")  # green-blind
gg_simulate_cvd(your_plot, type = "protan")  # red-blind
gg_simulate_cvd(your_plot, type = "tritan")  # blue-blind

Scale & Axis Checks

Catches misleading practices:

  • Truncated axes on bar charts
  • Dual y-axes
  • Inappropriate aspect ratios
  • Unlabeled log scales
gg_audit_scales(your_plot)

Automatic Fixes

Get code suggestions or apply fixes automatically:

# Get copy-paste code suggestions
gg_suggest_fixes(your_plot)

# Apply automatic fixes
fixed_plot <- gg_suggest_fixes(your_plot, auto_fix = TRUE)

Accessibility Auditing

Checks for:

  • Text size and readability
  • Point/line sizes
  • Redundant encoding (not relying on color alone)
  • Label clarity
gg_audit_accessibility(your_plot)

Example Workflow

library(ggplot2)
library(GGenemy)

# Create a problematic plot
problematic_plot <- ggplot(mtcars, aes(x = wt, y = mpg, color = factor(cyl))) +
  geom_point(size = 1) +
  scale_color_manual(values = c("red", "green", "blue")) +
  labs(title = "Plot", x = "wt", y = "mpg")

# Audit it
report <- gg_audit(problematic_plot)

# Get fix suggestions
gg_suggest_fixes(problematic_plot)

# Apply automatic fixes
improved_plot <- gg_suggest_fixes(problematic_plot, auto_fix = TRUE)

# View the improved plot
print(improved_plot)

Philosophy

GGenemy believes in:

  1. Accessibility First: Visualizations should be perceivable by everyone
  2. Honest Representation: Data should be presented without distortion
  3. Clarity Over Aesthetics: Readability trumps flashiness
  4. Constructive Guidance: We suggest fixes, not just criticisms

Roadmap

  • Color accessibility checking
  • Colorblind vision simulation
  • Scale and axis auditing
  • Text readability checks
  • Automatic fix suggestions
  • Integration with RMarkdown/Quarto for batch auditing
  • Custom rule sets
  • Interactive Shiny app for exploration

Contributing

GGenemy is in active development! Contributions are welcome:

Related Packages

Citation

citation("GGenemy")

License

MIT © Andy Man Yeung Tai


GGenemy: Making data visualization more accessible, honest, and clear.

Copy Link

Version

Install

install.packages('GGenemy')

Monthly Downloads

136

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Andy Man Yeung Tai

Last Published

November 3rd, 2025

Functions in GGenemy (0.1.0)

gg_audit_scales

Audit Scales and Axes for Misleading Practices
gg_audit_text

Audit Text Elements for Readability
gg_audit

Comprehensive Audit of ggplot2 Visualization
gg_simulate_cvd

Simulate Colorblind Vision
generate_fix_code

Generate fix code based on audit results
gg_audit_labels

Audit Plot Labels and Annotations
gg_audit_color

Audit Color Palette for Accessibility Issues
gg_suggest_fixes

Generate Code Suggestions to Fix Issues
print.gg_fix_suggestions

Print method for fix suggestions
print.gg_audit_report

Print method for audit reports
gg_audit_accessibility

Comprehensive Accessibility Audit
apply_fixes

Apply automatic fixes to a plot