Skip to content

Commit e09475f

Browse files
authored
don't fail when manual scales have missing values parameter. (#2916)
1 parent 7ed8930 commit e09475f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

R/scale-manual.r

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,14 @@ scale_discrete_manual <- function(aesthetics, ..., values) {
101101
}
102102

103103

104-
manual_scale <- function(aesthetic, values, ...) {
105-
force(values)
104+
manual_scale <- function(aesthetic, values = NULL, ...) {
105+
# check for missing `values` parameter, in lieu of providing
106+
# a default to all the different scale_*_manual() functions
107+
if (rlang::is_missing(values)) {
108+
values <- NULL
109+
} else {
110+
force(values)
111+
}
106112

107113
pal <- function(n) {
108114
if (n > length(values)) {

0 commit comments

Comments
 (0)