ggplot2 icon indicating copy to clipboard operation
ggplot2 copied to clipboard

Prevent mismapping when limits contain `NA` in non-last position

Open teunbrand opened this issue 2 months ago • 0 comments

This PR aims to fix #5756.

Briefly, it simply drops NA from limits before mapping, ensuring that only 'proper' values are matched.

Reprex from issue:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

ggplot(mpg, aes(displ, hwy, colour = factor(cyl))) +
  geom_point() + 
  scale_colour_discrete(limits = c("4", "5", NA, "8"))

Created on 2024-04-18 with reprex v2.1.0

teunbrand avatar Apr 18 '24 13:04 teunbrand