Skip to content

Commit 8835709

Browse files
authored
Removes usage of stat_bin2d() and similar (#5451)
* Removes usage of stat_bin2d * Removes usage of stat_binhex() * Removes geom_bin2d() * Changes name in rd_aesthetics
1 parent 182405b commit 8835709

19 files changed

+33
-33
lines changed

R/coord-cartesian-.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#'
5050
#' # You can see the same thing with this 2d histogram
5151
#' d <- ggplot(diamonds, aes(carat, price)) +
52-
#' stat_bin2d(bins = 25, colour = "white")
52+
#' stat_bin_2d(bins = 25, colour = "white")
5353
#' d
5454
#'
5555
#' # When zooming the scale, the we get 25 new bins that are the same

R/geom-bin2d.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#' rectangle's fill. This is a useful alternative to [geom_point()]
66
#' in the presence of overplotting.
77
#'
8-
#' @eval rd_aesthetics("stat", "bin2d")
8+
#' @eval rd_aesthetics("stat", "bin_2d")
99
#'
1010
#' @export
1111
#' @inheritParams layer
1212
#' @inheritParams geom_point
1313
#' @param geom,stat Use to override the default connection between
1414
#' `geom_bin_2d()` and `stat_bin_2d()`.
15-
#' @seealso [stat_binhex()] for hexagonal binning
15+
#' @seealso [stat_bin_hex()] for hexagonal binning
1616
#' @examples
1717
#' d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10)
1818
#' d + geom_bin_2d()

R/geom-count.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' @eval rd_aesthetics("geom", "point")
88
#' @param geom,stat Use to override the default connection between
99
#' `geom_count()` and `stat_sum()`.
10-
#' @seealso For continuous `x` and `y`, use [geom_bin2d()].
10+
#' @seealso For continuous `x` and `y`, use [geom_bin_2d()].
1111
#' @inheritParams layer
1212
#' @inheritParams geom_point
1313
#' @export

R/geom-density2d.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' @eval rd_aesthetics("geom", "density_2d")
1010
#' @eval rd_aesthetics("geom", "density_2d_filled")
1111
#' @seealso [geom_contour()], [geom_contour_filled()] for information about
12-
#' how contours are drawn; [geom_bin2d()] for another way of dealing with
12+
#' how contours are drawn; [geom_bin_2d()] for another way of dealing with
1313
#' overplotting.
1414
#' @param geom,stat Use to override the default connection between
1515
#' `geom_density_2d()` and `stat_density_2d()`.

R/geom-hex.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#' Divides the plane into regular hexagons, counts the number of cases in
44
#' each hexagon, and then (by default) maps the number of cases to the hexagon
55
#' fill. Hexagon bins avoid the visual artefacts sometimes generated by
6-
#' the very regular alignment of [geom_bin2d()].
6+
#' the very regular alignment of [geom_bin_2d()].
77
#'
88
#' @eval rd_aesthetics("geom", "hex")
9-
#' @seealso [stat_bin2d()] for rectangular binning
9+
#' @seealso [stat_bin_2d()] for rectangular binning
1010
#' @param geom,stat Override the default connection between `geom_hex()` and
11-
#' `stat_binhex()`.
11+
#' `stat_bin_hex()`.
1212
#' @export
1313
#' @inheritParams layer
1414
#' @inheritParams geom_point

R/geom-point.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#' useful for displaying the relationship between two continuous variables.
55
#' It can be used to compare one continuous and one categorical variable, or
66
#' two categorical variables, but a variation like [geom_jitter()],
7-
#' [geom_count()], or [geom_bin2d()] is usually more
7+
#' [geom_count()], or [geom_bin_2d()] is usually more
88
#' appropriate. A _bubblechart_ is a scatterplot with a third variable
99
#' mapped to the size of points.
1010
#'

R/geom-tile.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
#' # Inspired by the image-density plots of Ken Knoblauch
6161
#' cars <- ggplot(mtcars, aes(mpg, factor(cyl)))
6262
#' cars + geom_point()
63-
#' cars + stat_bin2d(aes(fill = after_stat(count)), binwidth = c(3,1))
64-
#' cars + stat_bin2d(aes(fill = after_stat(density)), binwidth = c(3,1))
63+
#' cars + stat_bin_2d(aes(fill = after_stat(count)), binwidth = c(3,1))
64+
#' cars + stat_bin_2d(aes(fill = after_stat(density)), binwidth = c(3,1))
6565
#'
6666
#' cars +
6767
#' stat_density(

R/stat-binhex.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ StatBinhex <- ggproto("StatBinhex", Stat,
4848

4949
compute_group = function(data, scales, binwidth = NULL, bins = 30,
5050
na.rm = FALSE) {
51-
check_installed("hexbin", reason = "for `stat_binhex()`")
51+
check_installed("hexbin", reason = "for `stat_bin_hex()`")
5252

5353
binwidth <- binwidth %||% hex_binwidth(bins, scales)
5454
wt <- data$weight %||% rep(1L, nrow(data))

R/stat-summary-2d.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' \item{`z`}{After binning, the z values of individual data points are no longer available.}
2222
#' }
2323
#' @seealso [stat_summary_hex()] for hexagonal summarization.
24-
#' [stat_bin2d()] for the binning options.
24+
#' [stat_bin_2d()] for the binning options.
2525
#' @inheritParams layer
2626
#' @inheritParams geom_point
2727
#' @inheritParams stat_bin_2d

man/coord_cartesian.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_bin_2d.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_count.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_density_2d.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_hex.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_point.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_tile.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/hmisc.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/stat_summary_2d.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-stat-bin2d.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test_that("binwidth is respected", {
22
df <- data_frame(x = c(1, 1, 1, 2), y = c(1, 1, 1, 2))
33
base <- ggplot(df, aes(x, y)) +
4-
stat_bin2d(geom = "tile", binwidth = 0.25)
4+
stat_bin_2d(geom = "tile", binwidth = 0.25)
55

66
out <- layer_data(base)
77
expect_equal(nrow(out), 2)
@@ -10,11 +10,11 @@ test_that("binwidth is respected", {
1010
expect_equal(out$xmax, c(1.25, 2), tolerance = 1e-7)
1111

1212
p <- ggplot(df, aes(x, y)) +
13-
stat_bin2d(geom = "tile", binwidth = c(0.25, 0.5, 0.75))
13+
stat_bin_2d(geom = "tile", binwidth = c(0.25, 0.5, 0.75))
1414
expect_snapshot_warning(ggplot_build(p))
1515

1616
p <- ggplot(df, aes(x, y)) +
17-
stat_bin2d(geom = "tile", origin = c(0.25, 0.5, 0.75))
17+
stat_bin_2d(geom = "tile", origin = c(0.25, 0.5, 0.75))
1818
expect_snapshot_warning(ggplot_build(p))
1919
})
2020

@@ -26,7 +26,7 @@ test_that("breaks override binwidth", {
2626

2727
df <- data_frame(x = 0:3, y = 0:3)
2828
base <- ggplot(df, aes(x, y)) +
29-
stat_bin2d(
29+
stat_bin_2d(
3030
breaks = list(x = integer_breaks, y = NULL),
3131
binwidth = c(0.5, 0.5)
3232
)

0 commit comments

Comments
 (0)