Skip to content

Document breaks/bins/binwidth parameters in stat/geom contour #3423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

21 changes: 11 additions & 10 deletions R/geom-contour.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
#' @inheritParams layer
#' @inheritParams geom_point
#' @inheritParams geom_path
#' @param bins,binwidth Calculate `breaks` using evenly-spaced values. Use `NULL`
#' to use the default [pretty()] breaks.
#' @param breaks A vector of breaks (overrides `bins` and `bindwidth`).
#' @param bins Number of contour bins. Overridden by `binwidth`.
#' @param binwidth The width of the contour bins. Overridden by `breaks`.
#' @param breaks Numeric vector to set the contour breaks.
#' Overrides `binwidth` and `bins`. By default, this is a vector of
#' length ten with [pretty()] breaks.
#' @seealso [geom_density_2d()]: 2d density contours
#' @export
#' @export
#' @examples
#' #' # Basic plot
#' v <- ggplot(faithfuld, aes(waiting, eruptions, z = density))
Expand Down Expand Up @@ -49,12 +50,12 @@
geom_contour <- function(mapping = NULL, data = NULL,
stat = "contour", position = "identity",
...,
lineend = "butt",
linejoin = "round",
linemitre = 10,
bins = NULL,
binwidth = NULL,
breaks = NULL,
lineend = "butt",
linejoin = "round",
linemitre = 10,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE) {
Expand All @@ -67,12 +68,12 @@ geom_contour <- function(mapping = NULL, data = NULL,
show.legend = show.legend,
inherit.aes = inherit.aes,
params = list(
lineend = lineend,
linejoin = linejoin,
linemitre = linemitre,
bins = bins,
binwidth = binwidth,
breaks = breaks,
lineend = lineend,
linejoin = linejoin,
linemitre = linemitre,
na.rm = na.rm,
...
)
Expand Down
6 changes: 6 additions & 0 deletions R/stat-contour.r
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ stat_contour <- function(mapping = NULL, data = NULL,
stat_contour_filled <- function(mapping = NULL, data = NULL,
geom = "polygon", position = "identity",
...,
bins = NULL,
binwidth = NULL,
breaks = NULL,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE) {
Expand All @@ -53,6 +56,9 @@ stat_contour_filled <- function(mapping = NULL, data = NULL,
show.legend = show.legend,
inherit.aes = inherit.aes,
params = list(
bins = bins,
binwidth = binwidth,
breaks = breaks,
na.rm = na.rm,
...
)
Expand Down
23 changes: 14 additions & 9 deletions man/geom_contour.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.