Simplified Legend and Guide Alignment for 'ggplot2'
Overview
Provides one-liner functions for common legend and guide operations in 'ggplot2'. Simplifies legend positioning, styling, wrapping, and collection across multi-panel plots created with 'patchwork' or 'cowplot'.
Bug Fixes
legend_style(by = <aes>, justification = ...)collided when two or more legends shared the same edge. The 1.1.9 fix routed each call to a single globaltheme(legend.justification.<side> = ...), so the second call overwrote the first —legend_style(by = "colour", justification = "left") + legend_style(by = "fill", justification = "right")on the top edge ended up with both legends pinned to the right. Per-legend justification now also stashes the requested rail position on the plot and rewrites theguide-box-<side>internal gtable at render time so each legend sits at its own fraction of the rail. The render-time path also reorders the guides so the gtable cell order matches the requested rail order. The global theme write is kept as a fallback for the single-legend case. (reported by Youtao)
Internal
- The render-time gtable post-processor checks ggplot2's guide-box layout shape (column count and pad-cell unit type) and falls back to the previous behavior with a one-shot warning if it doesn't match what ggguides was tested against (currently ggplot2 4.0.3) — so a future ggplot2 internal change degrades gracefully instead of producing wrong output.
- If a guide already has an explicit
guide_legend(order = N)set, per-legend justification reordering on that side is skipped and a warning is emitted, so the user-supplied order is never silently overwritten.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- WARNING12 OK, 1 WARNING2026-06-07
Show 1 earlier changeHide 1 earlier change
- OK14 OK2026-03-10
Documentation
- Help pages
- 34 (9 internal)includes a package overview page
- Examples that run
- 100%25 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 99%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
Stars over time
Releases over time
Commits over time
7 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/gcol33/ggguides on 2026-10-25.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2025-12-15Named in .Rbuildignore: CLAUDE.mdNamed in .gitignore: CLAUDE.mdCommits: at least 104 crediting it in the message
- Claude Opus 4.566 commits · Dec 2025 to Jan 2026
- Claude Opus 4.720 commits · Apr to May 2026
- Claude Opus 5.57 commits · Oct 2026
- Claude Opus 4.86 commits · May to Jun 2026
- Claude Fable 52 commits · Jun 2026
3 more models not listed. Some of these counts are a minimum, because the search stopped before the oldest commits.
Dependencies
Code & Tests
People & History
Package metadata
- First published
- 2026-01-09
- Total releases
- 4 / 1 yrs
- License
- MIT + file LICENSE OSI
- Download size
- 581 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("ggguides")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.