Skip to content

Commit d15151f

Browse files
committed
improve docs
1 parent b7a4119 commit d15151f

File tree

7 files changed

+109
-20
lines changed

7 files changed

+109
-20
lines changed

R/geom-bin2d.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ NULL
2525
#' # You can control the size of the bins by specifying the number of
2626
#' # bins in each direction:
2727
#' d + geom_bin_2d(bins = 10)
28-
#' d + geom_bin_2d(bins = 30)
28+
#' d + geom_bin_2d(bins = list(x = 30, y = 10))
2929
#'
3030
#' # Or by specifying the width of the bins
3131
#' d + geom_bin_2d(binwidth = c(0.1, 0.1))

R/stat-bin2d.R

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#' @param bins numeric vector giving number of bins in both vertical and
2-
#' horizontal directions. Set to 30 by default.
3-
#' @param binwidth Numeric vector giving bin width in both vertical and
4-
#' horizontal directions. Overrides `bins` if both set.
1+
#' @inheritParams stat_bin
52
#' @param drop if `TRUE` removes all cells with 0 counts.
63
#' @export
74
#' @rdname geom_bin_2d
@@ -11,11 +8,21 @@
118
#' ncount = "count, scaled to maximum of 1.",
129
#' ndensity = "density, scaled to a maximum of 1."
1310
#' )
11+
#' @section Controlling binning parameters for the x and y directions:
12+
#' The arguments `bins`, `binwidth`, `breaks`, `center`, and `boundary` can
13+
#' be set separately for the x and y directions. When given as a scalar, one
14+
#' value applies to both directions. When given as a vector of length two,
15+
#' the first is applied to the x direction and the second to the y direction.
16+
#' Alternatively, these can be a named list containing `x` and `y` elements,
17+
#' for example `list(x = 10, y = 20)`.
1418
stat_bin_2d <- function(mapping = NULL, data = NULL,
1519
geom = "tile", position = "identity",
1620
...,
1721
bins = 30,
1822
binwidth = NULL,
23+
center = NULL,
24+
boundary = NULL,
25+
breaks = NULL,
1926
drop = TRUE,
2027
na.rm = FALSE,
2128
show.legend = NA,
@@ -31,6 +38,9 @@ stat_bin_2d <- function(mapping = NULL, data = NULL,
3138
params = list2(
3239
bins = bins,
3340
binwidth = binwidth,
41+
center = center,
42+
boundary = boundary,
43+
breaks = breaks,
3444
drop = drop,
3545
na.rm = na.rm,
3646
...

R/stat-binhex.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
#' ncount = "count, scaled to maximum of 1.",
88
#' ndensity = "density, scaled to maximum of 1."
99
#' )
10+
#' @section Controlling binning parameters for the x and y directions:
11+
#' The arguments `bins` and `binwidth` can
12+
#' be set separately for the x and y directions. When given as a scalar, one
13+
#' value applies to both directions. When given as a vector of length two,
14+
#' the first is applied to the x direction and the second to the y direction.
15+
#' Alternatively, these can be a named list containing `x` and `y` elements,
16+
#' for example `list(x = 10, y = 20)`.
1017
stat_bin_hex <- function(mapping = NULL, data = NULL,
1118
geom = "hex", position = "identity",
1219
...,

R/stat-summary-2d.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#' @param drop drop if the output of `fun` is `NA`.
2929
#' @param fun function for summary.
3030
#' @param fun.args A list of extra arguments to pass to `fun`
31+
#' @inheritSection stat_bin_2d Controlling binning parameters for the x and y directions
3132
#' @export
3233
#' @examples
3334
#' d <- ggplot(diamonds, aes(carat, depth, z = price))

man/geom_bin_2d.Rd

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

man/geom_hex.Rd

Lines changed: 23 additions & 5 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: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)