Closed
Description
Problem
This issue emerged in #6469 and affects an estimated 8 packages.
Here is a minimal reproducible example.
devtools::load_all("~/packages/ggplot2/")
ggplot(mpg, aes(displ, hwy, colour = drv)) +
geom_point() +
scale_colour_manual(
values = structure(c(`4` = "blue", f = "red", r = "green"), class = "foobar"),
na.value = "gray"
)
#> Error in `vec_slice<-` at ggplot2/R/scale-.R:1318:7:
#> ! Can't convert `na_value` <character> to <foobar>.
Created on 2025-06-11 with reprex v2.1.1
The issue is the same as in #6474 in that {vctrs} is too strict for this usage. While #6474 fixed this in most cases, the cases remain when values
is a named vector.
Solution
We should probably copy the solution of #6474 and apply it to named palettes too.
Metadata
Metadata
Assignees
Labels
No labels