Skip to content

Commit 57ba39a

Browse files
authored
Merge branch 'main' into geomsf-updateshape
2 parents d74642a + 308d4c3 commit 57ba39a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+153
-53
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ggplot2 (development version)
22

33
* geom_sf now accepts shape names (@sierrajohnson, #5808)
4+
* Added `gg` class to `labs()` (@phispu, #5553).
45
* Missing values from discrete palettes are no longer translated
56
(@teunbrand, #5929).
67
* Fixed bug in `facet_grid(margins = TRUE)` when using expresssions

R/geom-smooth.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#' `predictdf()` generic and its methods. For most methods the standard
1010
#' error bounds are computed using the [predict()] method -- the
1111
#' exceptions are `loess()`, which uses a t-based approximation, and
12-
#' `glm()`, where the normal confidence interval is constructed on the link
12+
#' `glm()`, where the normal confidence band is constructed on the link
1313
#' scale and then back-transformed to the response scale.
1414
#'
1515
#' @eval rd_orientation()

R/labeller.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
#' # Interpreting the labels as plotmath expressions
8484
#' p + facet_grid(. ~ cyl2)
8585
#' p + facet_grid(. ~ cyl2, labeller = label_parsed)
86+
#'
87+
#' # Include optional argument in label function
88+
#' p + facet_grid(. ~ cyl, labeller = function(x) label_both(x, sep = "="))
8689
#' }
8790
#' @name labellers
8891
NULL
@@ -320,7 +323,7 @@ as_labeller <- function(x, default = label_value, multi_line = TRUE) {
320323
#'
321324
#' This function makes it easy to assign different labellers to
322325
#' different factors. The labeller can be a function or it can be a
323-
#' named character vectors that will serve as a lookup table.
326+
#' named character vector that will serve as a lookup table.
324327
#'
325328
#' In case of functions, if the labeller has class `labeller`, it
326329
#' is directly applied on the data frame of labels. Otherwise, it is

R/labels.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ labs <- function(..., title = waiver(), subtitle = waiver(), caption = waiver(),
139139
args <- args[!duplicated(names(args))]
140140
args <- rename_aes(args)
141141

142-
structure(args, class = "labels")
142+
structure(args, class = c("labels", "gg"))
143143
}
144144

145145
#' @rdname labs

R/layer.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
#' `NA`, the default, includes if any aesthetics are mapped.
5959
#' `FALSE` never includes, and `TRUE` always includes.
6060
#' It can also be a named logical vector to finely select the aesthetics to
61-
#' display.
61+
#' display. To include legend keys for all levels, even
62+
#' when no data exists, use `TRUE`. If `NA`, all levels are shown in legend,
63+
#' but unobserved levels are omitted.
6264
#' @param inherit.aes If `FALSE`, overrides the default aesthetics,
6365
#' rather than combining with them. This is most useful for helper functions
6466
#' that define both data and aesthetics and shouldn't inherit behaviour from

R/stat-density.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ reflect_density <- function(dens, bounds, from, to) {
242242
precompute_bw = function(x, bw = "nrd0") {
243243
bw <- bw[1]
244244
if (is.character(bw)) {
245+
bw <- to_lower_ascii(bw)
245246
bw <- arg_match0(bw, c("nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", "sj-dpi"))
246247
bw <- switch(
247248
to_lower_ascii(bw),

R/stat-smooth.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
#' `y ~ poly(x, 2)`, `y ~ log(x)`. `NULL` by default, in which case
1919
#' `method = NULL` implies `formula = y ~ x` when there are fewer than 1,000
2020
#' observations and `formula = y ~ s(x, bs = "cs")` otherwise.
21-
#' @param se Display confidence interval around smooth? (`TRUE` by default, see
21+
#' @param se Display confidence band around smooth? (`TRUE` by default, see
2222
#' `level` to control.)
2323
#' @param fullrange If `TRUE`, the smoothing line gets expanded to the range of the plot,
2424
#' potentially beyond the data. This does not extend the line into any additional padding
2525
#' created by `expansion`.
2626
#' @param xseq A numeric vector of values at which the smoother is evaluated.
2727
#' When `NULL` (default), `xseq` is internally evaluated as a sequence of `n`
2828
#' equally spaced points for continuous data.
29-
#' @param level Level of confidence interval to use (0.95 by default).
29+
#' @param level Level of confidence band to use (0.95 by default).
3030
#' @param span Controls the amount of smoothing for the default loess smoother.
3131
#' Smaller numbers produce wigglier lines, larger numbers produce smoother
3232
#' lines. Only used with loess, i.e. when `method = "loess"`,
@@ -40,8 +40,8 @@
4040
#' .details = "`stat_smooth()` provides the following variables, some of
4141
#' which depend on the orientation:",
4242
#' "y|x" = "Predicted value.",
43-
#' "ymin|xmin" = "Lower pointwise confidence interval around the mean.",
44-
#' "ymax|xmax" = "Upper pointwise confidence interval around the mean.",
43+
#' "ymin|xmin" = "Lower pointwise confidence band around the mean.",
44+
#' "ymax|xmax" = "Upper pointwise confidence band around the mean.",
4545
#' "se" = "Standard error."
4646
#' )
4747
#' @export

R/utilities-break.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#' table(cut_width(runif(1000), 0.1, center = 0))
2525
#' table(cut_width(runif(1000), 0.1, labels = FALSE))
2626
cut_interval <- function(x, n = NULL, length = NULL, ...) {
27+
if ((!is.null(n) && !is.null(length)) || (is.null(n) && is.null(length))) {
28+
cli::cli_abort("Specify exactly one of {.var n} and {.var length}.")
29+
}
2730
cut(x, breaks(x, "width", n, length), include.lowest = TRUE, ...)
2831
}
2932

man/borders.Rd

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

man/geom_abline.Rd

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

0 commit comments

Comments
 (0)