Skip to content

Commit 622cba7

Browse files
authored
Merge branch 'main' into issue-5647-geom-function-nodata-xaxis-title
2 parents 0b5fb1f + ee5c9e5 commit 622cba7

File tree

7 files changed

+18
-4
lines changed

7 files changed

+18
-4
lines changed

NEWS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# ggplot2 (development version)
22

33
* Fixed bug in `stat_function()` so x-axis title now produced automatically
4-
when no data added.
5-
(@phispu, #5647).
4+
when no data added. (@phispu, #5647).
5+
* geom_sf now accepts shape names (@sierrajohnson, #5808)
6+
* Added `gg` class to `labs()` (@phispu, #5553).
67
* Missing values from discrete palettes are no longer translated
78
(@teunbrand, #5929).
89
* Fixed bug in `facet_grid(margins = TRUE)` when using expresssions

R/geom-sf.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ GeomSf <- ggproto("GeomSf", Geom,
200200
if (!inherits(coord, "CoordSf")) {
201201
cli::cli_abort("{.fn {snake_class(self)}} can only be used with {.fn coord_sf}.")
202202
}
203+
if (is.character(data$shape)) {
204+
data$shape <- translate_shape_string(data$shape)
205+
}
203206

204207
data <- coord$transform(data, panel_params)
205208

R/labeller.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ as_labeller <- function(x, default = label_value, multi_line = TRUE) {
323323
#'
324324
#' This function makes it easy to assign different labellers to
325325
#' different factors. The labeller can be a function or it can be a
326-
#' named character vectors that will serve as a lookup table.
326+
#' named character vector that will serve as a lookup table.
327327
#'
328328
#' In case of functions, if the labeller has class `labeller`, it
329329
#' 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/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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# cut_interval gives the correct
2+
3+
Specify exactly one of `n` and `length`.
4+

tests/testthat/test-utilities-break.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test_that("cut_interval throws the correct error message", {
2+
expect_snapshot_error(cut_interval(x = 1:10, width = 10))
3+
})

0 commit comments

Comments
 (0)