-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Handle fine-grained show.legend properly #3490
Handle fine-grained show.legend properly #3490
Conversation
Travis fails on build R<=3.4, where # R 3.4.4 on RStudio Cloud
x <- c(a = TRUE, b = FALSE)
is.na(x["no_such_element"])
#> <NA>
#> TRUE
isTRUE(is.na(x["no_such_element"]))
#> [1] FALSE Created on 2019-08-18 by the reprex package (v0.2.1) |
# 1. show_legend can be multiple NAs | ||
# 2. isTRUE() was not tolerant for a named TRUE | ||
show_legend <- show_legend[!is.na(show_legend)] | ||
include <- length(show_legend) == 0 || any(show_legend) |
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.
Why does an empty show_legend
lead to inclusion here?
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.
iiuc, guide_geom()
shows a legend if
- the layer's mapping contains any of the corresponding aes and
- the user does not explicitly choose not to show the legend
So, the absence of the corresponding show.legend
should be translated as inclusion.
Does this answer your question? Sorry, I might not get your point....
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.
You are right - I'm probably just tired
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. Sorry for making you busy with reviewing pull requests :)
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
Fix #3461
Currently,
guide_geom.colorbar()
doesn't follow the way howguide_geom.legend()
handles the case whenshow.legend
is a named logical vector. This PR fixes it.Besides, this PR also fixes
guide_geom.legend()
to handle multiple logicals, which I should have fixed #3163.