Skip to content

Commit 7560b48

Browse files
committed
Don't train with infinite cont data.
Fixes #1394.
1 parent 81b66e6 commit 7560b48

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/scale-discrete-.r

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ ScaleDiscretePosition <- ggproto("ScaleDiscretePosition", ScaleDiscrete,
126126
dimension = function(self, expand = c(0, 0)) {
127127
disc_range <- c(1, length(self$get_limits()))
128128
disc <- expand_range(disc_range, 0, expand[2], 1)
129-
cont <- expand_range(self$range_c$range, expand[1], 0, expand[2])
130129

130+
# if no data was trained (i.e. range_c is infinite) return disc range
131+
if (any(is.infinite(self$range_c$range))) {
132+
return(disc)
133+
}
134+
135+
cont <- expand_range(self$range_c$range, expand[1], 0, expand[2])
131136
range(disc, cont)
132137
},
133138

0 commit comments

Comments
 (0)