Skip to content

Commit 22690b4

Browse files
committed
remove vestigial bin2d_breaks()
1 parent d0417c3 commit 22690b4

File tree

1 file changed

+0
-38
lines changed

1 file changed

+0
-38
lines changed

R/stat-bin2d.R

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -90,41 +90,3 @@ dual_param <- function(x, default = list(x = NULL, y = NULL)) {
9090
list(x = x, y = x)
9191
}
9292
}
93-
94-
bin2d_breaks <- function(scale, breaks = NULL, origin = NULL, binwidth = NULL,
95-
bins = 30, closed = "right") {
96-
# Bins for categorical data should take the width of one level,
97-
# and should show up centered over their tick marks. All other parameters
98-
# are ignored.
99-
if (scale$is_discrete()) {
100-
breaks <- scale$get_breaks()
101-
return(-0.5 + seq_len(length(breaks) + 1))
102-
} else {
103-
if (!is.null(breaks)) {
104-
breaks <- scale$transform(breaks)
105-
}
106-
}
107-
108-
if (!is.null(breaks))
109-
return(breaks)
110-
111-
range <- scale$get_limits()
112-
113-
if (is.null(binwidth) || identical(binwidth, NA)) {
114-
binwidth <- diff(range) / bins
115-
}
116-
check_number_decimal(binwidth)
117-
118-
if (is.null(origin) || identical(origin, NA)) {
119-
origin <- round_any(range[1], binwidth, floor)
120-
}
121-
check_number_decimal(origin)
122-
123-
breaks <- seq(origin, range[2] + binwidth, binwidth)
124-
125-
# Check if the last bin lies fully outside the range
126-
if (length(breaks) > 1 && breaks[length(breaks) - 1] >= range[2]) {
127-
breaks <- breaks[-length(breaks)]
128-
}
129-
bins(breaks, closed)$fuzzy
130-
}

0 commit comments

Comments
 (0)