-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Description
Briefly, when including NA
in the limits, I interpret that as wanting to display the na.value
for it.
This is fine (aside from #5749 (comment)).
library(ggplot2)
p <- ggplot(mpg, aes(displ, hwy, colour = factor(cyl))) +
geom_point()
p + scale_colour_discrete(limits = c("4", "5", "6", NA))
However when you don't have NA
as the last limit, anything after it gets the wrong mapping.
The cyl == 8
data become grey instead of blue.
p + scale_colour_discrete(limits = c("4", "5", NA, "8"))
Created on 2024-03-07 with reprex v2.1.0