|
28 | 28 | #' @export
|
29 | 29 | #' @inheritParams geom_point
|
30 | 30 | #' @param width Bar width. By default, set to 90\% of the resolution of the data.
|
| 31 | +#' @param binwidth \code{geom_bar} no longer has a binwidth argument - if |
| 32 | +#' you use it you'll get an warning telling to you use |
| 33 | +#' \code{\link{geom_histogram}} instead. |
31 | 34 | #' @param geom,stat Override the default connection between \code{geom_bar} and
|
32 | 35 | #' \code{stat_count}.
|
33 | 36 | #' @examples
|
|
71 | 74 | #' ggplot(mpg, aes(reorder_size(class))) + geom_bar()
|
72 | 75 | #' }
|
73 | 76 | geom_bar <- function(mapping = NULL, data = NULL, stat = "count",
|
74 |
| - position = "stack", width = NULL, ..., |
| 77 | + position = "stack", width = NULL, binwidth = NULL, ..., |
75 | 78 | na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) {
|
| 79 | + |
| 80 | + if (!is.null(binwidth)) { |
| 81 | + warning("`geom_bar()` no longer has a `binwidth` parameter. ", |
| 82 | + "Please use `geom_histogram()` instead.", call. = "FALSE") |
| 83 | + return(geom_histogram(mapping = mapping, data = data, |
| 84 | + position = position, width = width, binwidth = binwidth, ..., |
| 85 | + na.rm = na.rm, show.legend = show.legend, inherit.aes = inherit.aes)) |
| 86 | + } |
| 87 | + |
76 | 88 | layer(
|
77 | 89 | data = data,
|
78 | 90 | mapping = mapping,
|
|
0 commit comments