-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix labeller to pass .default for lookups (#4031) #4032
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
Conversation
Pass .default to as_labeller even when margin_labeller is null, such as when using named arguements for a lookup table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @waltersom! Could you please put space around the =
sign (following tidyverse style), and add a bullet to NEWS.md that briefly describes the change and ends with (@yourname, #issuenumber)?
While we're touching this code, I think we should also consider whether |
@karawoo I have made the requested changes. Also @clauswilke, I was looking at also passing |
Hmm, I see what you mean @waltersom. The library("ggplot2")
tdf <- data.frame(
x = c(1, 2, 3, 4),
y = c(4, 3, 2, 1),
a = c(0, 1, 0, 1),
b = c(1, 2, 2, 1)
)
ggplot(tdf, aes(x, y)) +
geom_point() +
facet_grid(
~ a + b,
labeller = labeller(
a = c(`0` = "a^2", `1` = "a[2]"),
b = c(`1` = "One", `2` = "Two"),
.default = label_parsed,
.multi_line = FALSE
)
) If we just passed along ggplot(tdf, aes(x, y)) +
geom_point() +
facet_grid(
~ a + b,
labeller = labeller(
a = c(`0` = "a^2", `1` = "a[2]"),
b = c(`1` = "One", `2` = "Two"),
.default = label_parsed,
.multi_line = FALSE
)
) I'd be inclined to merge this and open a separate issue for the |
This seems fine by me. The only reservation I have is that I don't know where we are in the current release cycle. Is it fine to merge into master or should we wait? |
Yeah, let's wait until this release is finished |
(CI failures are unrelated) |
(For failures, macOS runner will keep failing for a while until the R 4.0.2 installer is reliably available.) |
Pass .default to as_labeller even when margin_labeller is null, such as
when using named arguments for a lookup table.
This should make the behaviour match the documentation.
Fixes #4031