@@ -128,12 +128,14 @@ continuous_scale <- function(aesthetics, scale_name = deprecated(), palette, nam
128
128
}
129
129
130
130
transform <- as.transform(transform )
131
+ limits <- allow_lambda(limits )
132
+
131
133
if (! is.null(limits ) && ! is.function(limits )) {
132
134
limits <- transform $ transform(limits )
133
135
}
136
+ check_continuous_limits(limits , call = call )
134
137
135
138
# Convert formula to function if appropriate
136
- limits <- allow_lambda(limits )
137
139
breaks <- allow_lambda(breaks )
138
140
labels <- allow_lambda(labels )
139
141
rescaler <- allow_lambda(rescaler )
@@ -1402,6 +1404,16 @@ check_transformation <- function(x, transformed, name, arg = NULL, call = NULL)
1402
1404
cli :: cli_warn(msg , call = call )
1403
1405
}
1404
1406
1407
+ check_continuous_limits <- function (limits , ... ,
1408
+ arg = caller_arg(limits ),
1409
+ call = caller_env()) {
1410
+ if (is.null(limits ) || is.function(limits )) {
1411
+ return (invisible ())
1412
+ }
1413
+ check_numeric(limits , arg = arg , call = call , allow_na = TRUE )
1414
+ check_length(limits , 2L , arg = arg , call = call )
1415
+ }
1416
+
1405
1417
trans_support_nbreaks <- function (trans ) {
1406
1418
" n" %in% names(formals(trans $ breaks ))
1407
1419
}
0 commit comments