@@ -64,7 +64,7 @@ stat_bin <- function(mapping = NULL, data = NULL,
6464 breaks = NULL ,
6565 closed = c(" right" , " left" ),
6666 pad = FALSE ,
67- follow.scale = c( " off" , " minor " , " major " ) ,
67+ follow.scale = " off" ,
6868 na.rm = FALSE ,
6969 keep.zeroes = " all" ,
7070 orientation = NA ,
@@ -144,15 +144,9 @@ StatBin <- ggproto("StatBin", Stat,
144144 cli :: cli_abort(" Only one of {.arg boundary} and {.arg center} may be specified in {.fn {snake_class(self)}}." )
145145 }
146146
147- if (! is.null(params $ follow.scale )) {
148- params $ follow.scale <- match.arg(params $ follow.scale , c(" off" , " minor" , " major" ))
149- if (params $ follow.scale == " off" ) params $ follow.scale <- NULL
150- }
151- if (! is.null(params $ follow.scale ) && ! is.null(params $ breaks )) {
152- cli :: cli_abort(" Only one of {.arg follow.scale} and {.arg breaks} may be specified in {.fn {snake_class(self)}}." )
153- }
147+ params $ follow.scale <- match.arg(params $ follow.scale , c(" off" , " minor" , " major" ))
154148
155- if (is.null(params $ breaks ) && is.null(params $ binwidth ) && is.null(params $ bins ) && is.null (params $ follow.scale )) {
149+ if (is.null(params $ breaks ) && is.null(params $ binwidth ) && is.null(params $ bins ) && (params $ follow.scale == " off " )) {
156150 cli :: cli_inform(" {.fn {snake_class(self)}} using {.code bins = 30}. Pick better value with {.arg binwidth}." )
157151 params $ bins <- 30
158152 }
@@ -166,12 +160,12 @@ StatBin <- ggproto("StatBin", Stat,
166160 center = NULL , boundary = NULL ,
167161 closed = c(" right" , " left" ), pad = FALSE ,
168162 breaks = NULL , flipped_aes = FALSE , keep.zeroes = " all" ,
169- follow.scale = NULL ,
163+ follow.scale = " off " ,
170164 # The following arguments are not used, but must
171165 # be listed so parameters are computed correctly
172166 origin = NULL , right = NULL , drop = NULL ) {
173167 x <- flipped_names(flipped_aes )$ x
174- if (! is.null( follow.scale ) ) {
168+ if (follow.scale != " off " ) {
175169 breaks <- switch (follow.scale ,
176170 minor = scales [[x ]]$ get_breaks_minor(),
177171 major = scales [[x ]]$ get_breaks())
0 commit comments