Conversation
Project: ggpop Date: 13-July-2026 7:45 PM PT Branch: 393-center-legend-canvas Version: #381 R/legend-canvas.R: Core composite-legend builder plus legend_box/legend_ratios helpers. Adds base_width scaling (sizes scale by width/base_width so any width reproduces the calibrated proportions), auto-encloses group/symbol blocks taller than the grid, and warns when a small content_range stretches swatches into banners. Lets the template generalize to any figure width and topic without warping. R/key_legend.R: Renders group/symbol key entries. label_fontface now flows to titles and entry labels. Keeps composite legends visually consistent. R/marker_legend.R: Builds the icon grid section. Title now honors label_fontface instead of hardcoded plain. R/legend-strip.R: Stacks a legend under a plot. Handles patchwork mains via patchworkGrob so every panel renders. DESCRIPTION: Package metadata. Adds patchwork to Suggests for the legend-strip patchwork path. NAMESPACE: Generated exports. Exposes legend_box, legend_composite, legend_ratios.
Project: ggpop Date: 13-July-2026 7:45 PM PT Branch: 393-center-legend-canvas Version: #381 tests/testthat/test-15_legend-canvas.R: Tests for the composite-legend builder. Adds base_width scaling, auto-enclosure, swatch-aspect warning coverage, and a deterministic geometry snapshot of the AllModels compact legend as the gold standard; repairs the text_labels helper and a bind_rows case. Fails if the reference legend layout ever drifts. tests/testthat/_snaps/15_legend-canvas.md: Recorded gold-standard geometry for the AllModels legend. Portable (coordinates and sizes, not pixels) so it is stable across machines. tests/testthat/test-16_key-legend.R: key_legend tests. Accounts for the label layer rendered alongside each key entry. tests/testthat/test-17_legend-strip.R: legend_strip tests. Compares plot structure instead of brittle identical() on whole ggplots. tests/testthat/test-13_marker-legend.R: marker_legend tests. Aligned with the label_fontface title change.
Project: ggpop Date: 13-July-2026 7:46 PM PT Branch: 393-center-legend-canvas Version: #381 NEWS.md: User-facing changelog. Adds bullets for base_width scaling, the section auto-enclosure, and the swatch-aspect warning. man/legend_composite.Rd, man/legend_canvas.Rd, man/legend_box.Rd, man/legend_ratios.Rd, man/key_legend.Rd, man/legend_strip.Rd: Regenerated roxygen docs. Cover base_width, the ylim auto-enclosure, and the swatch-aspect warning. _pkgdown.yml: Reference index. Lists legend_box, legend_composite, legend_ratios under Legends and icons.
Project: ggpop Date: 13-July-2026 8:36 PM PT Branch: 393-center-legend-canvas Version: #381 tests/testthat/test-15_legend-canvas.R: Gold-standard test for the AllModels compact legend. Switches it from a geometry value snapshot to a rendered PNG image snapshot, matching the repo convention (test-12/13/17); drops the now-unused geometry helper. Locks the reference legend the same way as the other renders. tests/testthat/_snaps/15_legend-canvas/allmodels-frontier-compact-legend.png: Recorded golden of the AllModels compact legend (Modality tiles, age grid, frontier symbols, fitted border). tests/testthat/_snaps/15_legend-canvas/legend-canvas-composite.png: Recorded golden for the existing legend_canvas composite render test.
Project: ggpop Date: 13-July-2026 10:40 PM PT Branch: 393-center-legend-canvas Version: #381 tests/testthat/_snaps/17_legend-strip/legend-strip-composite.png: Recorded golden for the legend_strip composite render test. The test had no committed golden, so it recorded and never compared. Committing it makes the test lock the render like the other snapshots. tests/testthat/_snaps/17_legend-strip/legend-strip-simcrc-style.png: Recorded golden for the SimCRC-style legend_strip render test. Same reason - no golden meant no real comparison ran. Locks the grouped icon-scatter plus composite legend strip.
Project: ggpop Date: 14-July-2026 7:23 AM PT Branch: 393-center-legend-canvas Version: #381 vignettes/articles/marker-legend.qmd: The Icon Legends article on the pkgdown (GitHub Pages) site. Adds a legend_composite() section - the one-call bordered composite legend, base_width width-scaling, the keep-compact-do-not-stretch guidance plus the swatch-aspect warning, and the Font Awesome + custom SVG icon mix. Puts the new composite-legend capabilities on the documentation site.
Project: ggpop Date: 14-July-2026 5:12 PM PT Branch: 393-center-legend-canvas Version: #381 vignettes/articles/marker-legend.qmd: The pkgdown "Icon Legends" article documenting legend_canvas/legend_composite/legend_strip. The composite-legend figures used bundled SVG markers on a delivery topic; requested Font Awesome icons and a new topic. Retopics Figures 4-6 to an 8-day weather forecast (sun/cloud-rain/wind/snowflake) driven by one shared df_legend; compact symbol labels keep the bordered composite from clipping right-edge text.
Add legend_composite wrapper and center legend_canvas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promotes the #393 composite-legend work from Dev to main: the opinionated
legend_composite()wrapper on top of thelegend_canvas()primitives, thedefault-centering fix, a width-agnostic
base_widthgeneralization, locked PNGrender snapshots, and the reworked pkgdown "Icon Legends" article.
DESCRIPTIONstays at
1.8.0on both sides - no version bump.What changed
R/legend-canvas.R:legend_canvas,legend_box,legend_composite,legend_ratios).legend_composite()(one-call grid/group/symbol + fittedlegend_box()border) andbase_widthscaling for identical proportions at any output width.legend_canvas()by default via a symmetricx_margin+alignarg, and warns (ggpop_swatch_aspect_warning) when a smallcontent_rangestretches swatches into banners.R/key_legend.R,R/legend-strip.R,R/marker_legend.R:legend_composite().DESCRIPTION,NAMESPACE,NEWS.md,_pkgdown.yml,man/*.Rd:legend_box/legend_composite/legend_ratios, adds their.Rdtopics + pkgdown entries, records the changes inNEWS.md.tests/testthat/test-13/15/16/17.R+_snaps/*.png:allmodels-frontier-compact-legend.pngand strip composites, base-width scaling, enclosure, and swatch-aspect warning tests.vignettes/articles/marker-legend.qmd:legend_composite()and retopics Figures 4-6 to an 8-day weather forecast driven by Font Awesome icons and one shareddf_legend.CHANGELOG.md:NEWS.md.Notes
Merging removes
CHANGELOG.md(81 lines) from main - Dev consolidated onNEWS.md. Confirm that is intended before merging. This PR is create-only; themerge and any release steps are deliberately left for a separate pass.
Project: ggpop Date: 15-July-2026 9:29 PM PT
Branch: Dev -> Base: main
Issue: #393 | Version: #381