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
- DAAF-Contribution-Community/daaftheir own version, first seen Nov 3, 2026
- GiulSposito/r-claude-skillstheir own version, first seen Apr 14, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- DAAF-Contribution-Community/daaf★ 239same name
- 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.
- AGENTS.mdAGENTS.md
- d3Skill
- inspirationSkill
- matplotlibSkill
- roast-my-chartSkill
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
- Distinctive: line 12
Always use tidyverse syntax (dplyr, tidyr, stringr, forcats)
- Very specific: line 13
Use the native pipe operator |>
- Very specific: line 14
Use snake_case for all variable and column names
- Very specific: line 16
Use named arguments for clarity: ggplot(data = df, mapping = aes(x = var1, y = var2))
- Very specific: line 17
Use geom_col() when you have explicit y values, geom_bar() only when counting
- Very specific: line 22
Start from theme_minimal(base_size = 14) and override elements with theme().
- Very specific: line 23
Use element_blank() to remove elements, not element_line(color = "white").
- Very specific: line 29
Use coord_cartesian(xlim = ..., ylim = ...) for zooming (preserves data).
- Very specific: line 31
Use expand = expansion(mult = 0) or expansion(add = 0) to control padding.
- Very specific: line 36
Remove a legend title with labs(color = NULL) (or fill = NULL…).
- Very specific: line 37
Use guide_legend(nrow = 1) for compact horizontal legends.
- Very specific: line 38
Add direct labels with geom_text() or geom_label().
- Very specific: line 42
Use facet_wrap(vars(category)) for a single variable, facet_grid(rows = vars(x), cols = vars(y)) for cross-breakdowns.
- Very specific: line 49
Always set bg = "white" explicitly.
- Distinctive: line 53
Don't mix base R plotting with ggplot2.
- Very specific: line 54
Don't use color when you mean fill (bars, areas, and tiles use fill.
- Very specific: line 55
Don't forget factor() to make a numeric column categorical.
- Very specific: line 56
Don't set aesthetic properties inside aes() — constants go outside: geom_point(color = "red"), not geom_point(aes(color = "red")).
- Very specific: line 57
Don't use geom_bar(stat = "identity") — use geom_col() instead.
- Distinctive: line 58
Don't rely on the RStudio preview pane for sizing — always export and inspect.
≈ “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.
Files
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_casefor 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 specifyingwidth,height,units, anddpi
Theme & Styling
- Start from
theme_minimal(base_size = 14)and override elements withtheme(). - Use
element_blank()to remove elements, notelement_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). Usescale_*_continuous(limits = ...)only to filter data. - Format axis labels with
scales::label_comma(),scales::label_percent(), etc. - Use
expand = expansion(mult = 0)orexpansion(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)(orfill = NULL…). - Use
guide_legend(nrow = 1)for compact horizontal legends. - Add direct labels with
geom_text()orgeom_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 defaultscales = "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
colorwhen you meanfill(bars, areas, and tiles usefill; points and lines usecolor). - Don't forget
factor()to make a numeric column categorical. - Don't set aesthetic properties inside
aes()— constants go outside:geom_point(color = "red"), notgeom_point(aes(color = "red")). - Don't use
geom_bar(stat = "identity")— usegeom_col()instead. - Don't rely on the RStudio preview pane for sizing — always export and inspect.
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
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.

