Skip to content

Commit a43539e

Browse files
committed
add freeze method to viewscales
1 parent 97edd62 commit a43539e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

R/scale-view.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,21 @@ ViewScale <- ggproto("ViewScale", NULL,
150150
}
151151

152152
self$rescale(b)
153+
},
154+
freeze = function(self) {
155+
if (self$scale$is_discrete()) {
156+
limits <- self$get_limits()
157+
} else {
158+
limits <- self$continuous_range
159+
}
160+
ggproto(
161+
NULL, self$scale,
162+
breaks = self$get_breaks(),
163+
minor_breaks = self$get_breaks_minor(),
164+
limits = limits,
165+
expand = c(0, 0, 0, 0),
166+
continuous_limits = self$continuous_range,
167+
train = function (...) NULL
168+
)
153169
}
154170
)

0 commit comments

Comments
 (0)