diff --git a/NAMESPACE b/NAMESPACE index 3b2a7bb7e5..abe38d251f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -343,6 +343,7 @@ export(geom_abline) export(geom_area) export(geom_bar) export(geom_bin2d) +export(geom_bin_2d) export(geom_blank) export(geom_boxplot) export(geom_col) diff --git a/R/geom-bin2d.r b/R/geom-bin2d.r index 0555996419..c5f6231e13 100644 --- a/R/geom-bin2d.r +++ b/R/geom-bin2d.r @@ -11,20 +11,20 @@ #' @inheritParams layer #' @inheritParams geom_point #' @param geom,stat Use to override the default connection between -#' `geom_bin2d()` and `stat_bin2d()`. +#' `geom_bin_2d()` and `stat_bin_2d()`. #' @seealso [stat_binhex()] for hexagonal binning #' @examples #' d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10) -#' d + geom_bin2d() +#' d + geom_bin_2d() #' #' # You can control the size of the bins by specifying the number of #' # bins in each direction: -#' d + geom_bin2d(bins = 10) -#' d + geom_bin2d(bins = 30) +#' d + geom_bin_2d(bins = 10) +#' d + geom_bin_2d(bins = 30) #' #' # Or by specifying the width of the bins -#' d + geom_bin2d(binwidth = c(0.1, 0.1)) -geom_bin2d <- function(mapping = NULL, data = NULL, +#' d + geom_bin_2d(binwidth = c(0.1, 0.1)) +geom_bin_2d <- function(mapping = NULL, data = NULL, stat = "bin2d", position = "identity", ..., na.rm = FALSE, @@ -45,3 +45,9 @@ geom_bin2d <- function(mapping = NULL, data = NULL, ) ) } + +#' @export +#' @rdname geom_bin_2d +#' @usage NULL +geom_bin2d <- geom_bin_2d + diff --git a/R/stat-bin2d.r b/R/stat-bin2d.r index 5429aea67d..dd1ed1b77d 100644 --- a/R/stat-bin2d.r +++ b/R/stat-bin2d.r @@ -4,7 +4,7 @@ #' horizontal directions. Overrides `bins` if both set. #' @param drop if `TRUE` removes all cells with 0 counts. #' @export -#' @rdname geom_bin2d +#' @rdname geom_bin_2d #' @section Computed variables: #' \describe{ #' \item{count}{number of points in bin} @@ -41,7 +41,7 @@ stat_bin_2d <- function(mapping = NULL, data = NULL, #' @export -#' @rdname geom_bin2d +#' @rdname geom_bin_2d #' @usage NULL stat_bin2d <- stat_bin_2d diff --git a/man/geom_bin2d.Rd b/man/geom_bin_2d.Rd similarity index 95% rename from man/geom_bin2d.Rd rename to man/geom_bin_2d.Rd index 884c62d01a..131d24942f 100644 --- a/man/geom_bin2d.Rd +++ b/man/geom_bin_2d.Rd @@ -1,12 +1,13 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/geom-bin2d.r, R/stat-bin2d.r -\name{geom_bin2d} +\name{geom_bin_2d} +\alias{geom_bin_2d} \alias{geom_bin2d} \alias{stat_bin_2d} \alias{stat_bin2d} \title{Heatmap of 2d bin counts} \usage{ -geom_bin2d( +geom_bin_2d( mapping = NULL, data = NULL, stat = "bin2d", @@ -75,7 +76,7 @@ that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. \code{\link[=borders]{borders()}}.} \item{geom, stat}{Use to override the default connection between -\code{geom_bin2d()} and \code{stat_bin2d()}.} +\code{geom_bin_2d()} and \code{stat_bin_2d()}.} \item{bins}{numeric vector giving number of bins in both vertical and horizontal directions. Set to 30 by default.} @@ -115,15 +116,15 @@ Learn more about setting these aesthetics in \code{vignette("ggplot2-specs")}. \examples{ d <- ggplot(diamonds, aes(x, y)) + xlim(4, 10) + ylim(4, 10) -d + geom_bin2d() +d + geom_bin_2d() # You can control the size of the bins by specifying the number of # bins in each direction: -d + geom_bin2d(bins = 10) -d + geom_bin2d(bins = 30) +d + geom_bin_2d(bins = 10) +d + geom_bin_2d(bins = 30) # Or by specifying the width of the bins -d + geom_bin2d(binwidth = c(0.1, 0.1)) +d + geom_bin_2d(binwidth = c(0.1, 0.1)) } \seealso{ \code{\link[=stat_binhex]{stat_binhex()}} for hexagonal binning