-
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
Change in scale_color_manual behavior in 3.5.x, adds NA to legend #6015
Comments
I think this issue boils down to the following question: is it better to take names of the |
My opinion, take it for nothing more than that: The plot produced by 3.5.1 seems reasonable for the input data. There are points with no If somebody doesn't want the |
I don't think either option is "right". I am pointing out a change in behavior in 3.5.x within ggplot2::manual_scale. NA groups can be omitted by defining limits() but this was not required in previous versions. On my end, I have to go back and edit ~15 scripts I use to generate reports to include limits being defined after updating to 3.5.x. Feel free to close as this does not break any functionality, but does slightly impair reproducibility between 3.4.x and 3.5.x. |
I concur. It is probably better to have heuristics reflect more of the data than less. |
Per @teunbrand request to open an issue re: #5214 (comment)
NAs are printed in the legend when using scale_color_manual()
Identical plot made without specifying factors
ggplot(df, aes(x = xvar, y = yvar, color = lab_grp)) + geom_point() + scale_color_manual(values = c("red", "blue"))
Likely caused by change ggplot2::manual_scale in line:
x <- intersect(x, c(names(values), NA)) %||% character()
3.4.x code:
3.5.x code:
The text was updated successfully, but these errors were encountered: