Skip to content

Commit b4e3aea

Browse files
authored
More accurate check for palette names (#4093)
Some of the names can be NA if more colors are requested than are present in the palette. is_named() would return FALSE in this case, so it's changed here to `!is_null(names(pal))`.
1 parent e2eeb6a commit b4e3aea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/scale-.r

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ ScaleDiscrete <- ggproto("ScaleDiscrete", Scale,
806806
self$n.breaks.cache <- n
807807
}
808808

809-
if (is_named(pal)) {
809+
if (!is_null(names(pal))) {
810810
# if pal is named, limit the pal by the names first,
811811
# then limit the values by the pal
812812
idx_nomatch <- is.na(match(names(pal), limits))

0 commit comments

Comments
 (0)