Skip to content

Commit 7ec9d4d

Browse files
committed
1 parent a84896f commit 7ec9d4d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/scale-.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,17 +1103,20 @@ ScaleDiscrete <- ggproto("ScaleDiscrete", Scale,
11031103
)
11041104
},
11051105

1106-
new = function(self, aesthetics, palette = NULL, limits = NULL, call = caller_call(),
1106+
new = function(self, aesthetics = NULL, palette = NULL, limits = NULL, call = caller_call(),
11071107
range = DiscreteRange$new(),
11081108
..., super = NULL) {
11091109
call <- call %||% current_call()
1110+
super <- super %||% self
11101111
limits <- allow_lambda(limits)
11111112
if (!is.function(limits) && (length(limits) > 0 && !is.discrete(limits))) {
11121113
cli::cli_warn(c(
11131114
"Continuous limits supplied to discrete scale.",
11141115
i = "Did you mean {.code limits = factor(...)} or {.fn scale_*_continuous}?"
11151116
), call = call)
11161117
}
1118+
aesthetics <- aesthetics %||% super$aesthetics
1119+
palette <- palette %||% .subset2(super, "palette")
11171120
if (identical(palette, identity) && any(is_position_aes(aesthetics))) {
11181121
palette <- seq_len
11191122
}

0 commit comments

Comments
 (0)