File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ limits <- function(lims, var) UseMethod("limits")
47
47
# ' @export
48
48
limits.numeric <- function (lims , var ) {
49
49
stopifnot(length(lims ) == 2 )
50
- if (sum (is.na(lims )) == 0 & lims [1 ] > lims [2 ]) {
50
+ if (! any (is.na(lims )) && lims [1 ] > lims [2 ]) {
51
51
trans <- " reverse"
52
52
} else {
53
53
trans <- " identity"
Original file line number Diff line number Diff line change @@ -296,11 +296,16 @@ scale_limits <- function(scale) {
296
296
}
297
297
298
298
299
+ # if scale contains a NULL, use the default scale range
300
+ # if scale contains a NA, use the default range for that axis, otherwise
301
+ # use the user defined limit for that axis
299
302
# ' @export
300
303
scale_limits.default <- function (scale ) {
301
- if (! is.null(scale $ limits ))
302
- ifelse(! is.na(scale $ limits ),scale $ limits ,scale $ range $ range )
303
- else scale $ range $ range
304
+ if (! is.null(scale $ limits )) {
305
+ ifelse(! is.na(scale $ limits ), scale $ limits , scale $ range $ range )
306
+ } else {
307
+ scale $ range $ range
308
+ }
304
309
}
305
310
306
311
# @kohske
You can’t perform that action at this time.
0 commit comments