Skip to content

Adding Arrows to the Legend#68

Merged
rsh52 merged 6 commits intomainfrom
arrows-in-legend
Mar 11, 2026
Merged

Adding Arrows to the Legend#68
rsh52 merged 6 commits intomainfrom
arrows-in-legend

Conversation

@rsh52
Copy link
Copy Markdown
Contributor

@rsh52 rsh52 commented Mar 11, 2026

Description

This PR introduces a number of changes listed below. In summary, users now have the ability to add arrows to the ggswim legend to clarify what they mean.

Proposed Changes

List changes below in bullet format:

  • Updates to geom_swim_arrow():
    • pal_arrows() internal function added
    • draw_key_swim_arrow() defined
    • roxygen docs updated
    • extract_arrow_aesthetics() convenience function added
    • tests updated for fuller coverage
  • scale_arrow_discrete() added to align with scale_marker_discrete()
    • tests added
  • "Adding Arrows" vignette updated to showcase scale_arrow_discrete()
  • Linting and Styling updates

Screenshots
If applicable, add screenshots to help explain the proposed changes

Issue Addressed

Closes #67

PR Checklist

Before submitting this PR, please check and verify below that the submission meets the below criteria:

  • New/revised functions have associated tests
  • [NA] New/revised functions that update downstream outputs have associated static testing files (.RDS) updated under inst/testdata/create_test_data.R
  • New/revised functions use appropriate naming conventions
  • New/revised functions don't repeat code
  • [NA] Code changes are less than 250 lines total
  • Issues linked to the PR using GitHub's list of keywords
  • The appropriate reviewer is assigned to the PR
  • The appropriate developers are assigned to the PR
  • Pre-release package version incremented using usethis::use_version()

Code Review

This section to be used by the reviewer and developers during Code Review after PR submission

Code Review Checklist

  • I checked that new files follow naming conventions and are in the right place
  • I checked that documentation is complete, clear, and without typos
  • I added/edited comments to explain "why" not "how"
  • I checked that all new variable and function names follow naming conventions
  • I checked that new tests have been written for key business logic and/or bugs that this PR fixes
  • I checked that new tests address important edge cases

rsh52 added 4 commits March 10, 2026 09:07
Introduce discrete arrow palette and rendering for swim arrows: add pal_arrows(), draw_key_swim_arrow(), scale_arrow_discrete() and format.swim_arrow(), and extend GeomSwimArrow to support per-row arrow aesthetics (colour, fill, type) and custom arrow heads. Update NAMESPACE to export the new S3 method and scale, bump RoxygenNote to 7.3.3, and adjust documentation (show.legend behavior, ggplot2 references, and scale_marker_discrete docs) to reflect the new features and legend semantics.
Introduce discrete arrow scale and defaults, and refactor arrow handling in geom_swim_arrow.

- Add scale_arrow_discrete() and related defaults (.default_arrow_colours, .default_arrow_fills, .default_arrow_types, .default_arrow_limits) in R/scale_arrow.R and export them via NAMESPACE; include generated Rd docs.
- Update pal_arrows to use the new default arrow values when arguments are omitted.
- Move format.swim_arrow implementation into the new file.
- Fix draw_key_swim_arrow fill fallback and mark it internal, adding @Keywords internal.
- Add extract_arrow_aesthetics() helper to centralize extraction of arrow fields and simplify GeomSwimArrow$draw_panel: use the helper, enforce a single arrow type per layer, and ensure proper fill/colour handling.

These changes enable a reusable scale for arrow aesthetics, consolidate defaults, and simplify arrow aesthetic extraction and rendering.
Lots of edits and updates!
@rsh52 rsh52 self-assigned this Mar 11, 2026
@rsh52 rsh52 added the enhancement New feature or request label Mar 11, 2026
@rsh52 rsh52 marked this pull request as ready for review March 11, 2026 14:07
@rsh52 rsh52 merged commit d75fba4 into main Mar 11, 2026
11 checks passed
@rsh52 rsh52 deleted the arrows-in-legend branch March 11, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add arrows to the legend

1 participant