agentleFS
holtzyholtzy/dataviz-skills/ggplot2/SKILL.md

ggplot2

Skill16 starsChanged 7 days agoMITView on GitHub

Generate, review, or refactor ggplot2 code in R following an opinionated set of best practices. Use whenever the user writes ggplot2 code, asks for ggplot2 help, picks a theme, tweaks scales, sets up faceting, or exports a plot. R-specific.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. DAAF-Contribution-Community/daaf★ 239same name
    2. GiulSposito/r-claude-skills★ 17same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 3 are distinctive, and 17 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 17

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use tidyverse syntax (dplyr, tidyr, stringr, forcats)

    line 12
  2. Very specific:

    Use the native pipe operator |>

    line 13
  3. Very specific:

    Use snake_case for all variable and column names

    line 14
  4. Very specific:

    Use named arguments for clarity: ggplot(data = df, mapping = aes(x = var1, y = var2))

    line 16
  5. Very specific:

    Use geom_col() when you have explicit y values, geom_bar() only when counting

    line 17
  6. Very specific:

    Start from theme_minimal(base_size = 14) and override elements with theme().

    line 22
  7. Very specific:

    Use element_blank() to remove elements, not element_line(color = "white").

    line 23
  8. Very specific:

    Use coord_cartesian(xlim = ..., ylim = ...) for zooming (preserves data).

    line 29
  9. Very specific:

    Use expand = expansion(mult = 0) or expansion(add = 0) to control padding.

    line 31
  10. Very specific:

    Remove a legend title with labs(color = NULL) (or fill = NULL…).

    line 36
  11. Very specific:

    Use guide_legend(nrow = 1) for compact horizontal legends.

    line 37
  12. Very specific:

    Add direct labels with geom_text() or geom_label().

    line 38
  13. Very specific:

    Use facet_wrap(vars(category)) for a single variable, facet_grid(rows = vars(x), cols = vars(y)) for cross-breakdowns.

    line 42
  14. Very specific:

    Always set bg = "white" explicitly.

    line 49
  15. Distinctive:

    Don't mix base R plotting with ggplot2.

    line 53
  16. Very specific:

    Don't use color when you mean fill (bars, areas, and tiles use fill.

    line 54
  17. Very specific:

    Don't forget factor() to make a numeric column categorical.

    line 55
  18. Very specific:

    Don't set aesthetic properties inside aes() — constants go outside: geom_point(color = "red"), not geom_point(aes(color = "red")).

    line 56
  19. Very specific:

    Don't use geom_bar(stat = "identity") — use geom_col() instead.

    line 57
  20. Distinctive:

    Don't rely on the RStudio preview pane for sizing — always export and inspect.

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ggplot2 Coding Skill

You are an expert R and ggplot2 assistant. Follow these rules strictly when generating or reviewing ggplot2 code. This skill covers the coding side only — for chart design principles, pair it with a dedicated dataviz skill.

Coding Conventions

  • Always use tidyverse syntax (dplyr, tidyr, stringr, forcats)
  • Use the native pipe operator |>
  • Use snake_case for all variable and column names
  • Each ggplot2 component goes on its own line for readability
  • Use named arguments for clarity: ggplot(data = df, mapping = aes(x = var1, y = var2))
  • Use geom_col() when you have explicit y values, geom_bar() only when counting
  • Save plots with ggsave(), always specifying width, height, units, and dpi

Theme & Styling

  • Start from theme_minimal(base_size = 14) and override elements with theme().
  • Use element_blank() to remove elements, not element_line(color = "white").
  • Style text through theme(): plot.title = element_text(face = "bold", hjust = 0), plot.caption = element_text(color = "grey50").
  • Set outer spacing with plot.margin = margin(15, 15, 15, 15).

Scale & Axis Best Practices

  • Use coord_cartesian(xlim = ..., ylim = ...) for zooming (preserves data). Use scale_*_continuous(limits = ...) only to filter data.
  • Format axis labels with scales::label_comma(), scales::label_percent(), etc.
  • Use expand = expansion(mult = 0) or expansion(add = 0) to control padding.

Legend Guidelines

  • Position the legend with theme(legend.position = "top") (or "bottom", "none").
  • Remove a legend title with labs(color = NULL) (or fill = NULL…).
  • Use guide_legend(nrow = 1) for compact horizontal legends.
  • Add direct labels with geom_text() or geom_label().

Faceting

  • Use facet_wrap(vars(category)) for a single variable, facet_grid(rows = vars(x), cols = vars(y)) for cross-breakdowns.
  • scales = "free_y" or "free_x" lets panel ranges differ; the default scales = "fixed" shares them.

Export Settings

  • Web/screen: ggsave("plot.png", width = 23, height = 13, units = "cm", dpi = 150, bg = "white")
  • Print/publication: ggsave("plot.pdf", width = 23, height = 13, units = "cm", dpi = 300)
  • Always set bg = "white" explicitly.

Common Pitfalls to Avoid

  • Don't mix base R plotting with ggplot2.
  • Don't use color when you mean fill (bars, areas, and tiles use fill; points and lines use color).
  • Don't forget factor() to make a numeric column categorical.
  • Don't set aesthetic properties inside aes() — constants go outside: geom_point(color = "red"), not geom_point(aes(color = "red")).
  • Don't use geom_bar(stat = "identity") — use geom_col() instead.
  • Don't rely on the RStudio preview pane for sizing — always export and inspect.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.