Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purrr style lambda notation in scale arguments #4427

Merged
merged 10 commits into from
Apr 28, 2021

Conversation

teunbrand
Copy link
Collaborator

This PR aims to enable purrr style lambda notation for scale arguments that accept functions (limits, breaks, minor_breaks, labels, rescaler and oob). It does so by converting formulas to functions in the scale constructors. Thomas mentioned that lambda notation should work in #4173 (comment), but the notation is currently not enabled.

This PR has partial overlap in scope and in functions altered with #4188. Notable differences are that this PR doesn't touch facet labellers, but applies the lambda notation to more arguments and in all three types of scales (continuous, binned and discrete).

Thank you for considering!

@teunbrand
Copy link
Collaborator Author

I came across issue #4103 as well, which seemed related and worth mentioning.

Copy link
Member

@yutannihilation yutannihilation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@thomasp85
Can we have this in 3.3.4?

tests/testthat/test-scales.r Outdated Show resolved Hide resolved
Co-authored-by: Hiroaki Yutani <yutani.ini@gmail.com>
@yutannihilation yutannihilation added this to the ggplot2 3.3.4 milestone Apr 24, 2021
@yutannihilation
Copy link
Member

@thomasp85
I'm merging this if there's no concern. This supersedes some part of #4188, and as #4188 is in the milestones for v3.3.4, I think it's good to include this in v3.3.4.

@thomasp85
Copy link
Member

Sorry for lack of response, go ahead and merge

@yutannihilation
Copy link
Member

It's fine. Thanks for confirming!

@yutannihilation yutannihilation merged commit b8cc043 into tidyverse:master Apr 28, 2021
@teunbrand teunbrand deleted the scales_lambda branch April 28, 2021 13:05
netique added a commit to netique/ggplot2 that referenced this pull request May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants