Skip to content

Commit 6f1ee38

Browse files
authored
Merge branch 'main' into boxplot_key
2 parents dfa2215 + 0d0de37 commit 6f1ee38

17 files changed

+247
-203
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,8 @@ jobs:
6262
cache-version: 2
6363
extra-packages: >
6464
any::rcmdcheck,
65-
maps=?ignore-before-r=3.5.0,
6665
Hmisc=?ignore-before-r=3.6.0,
67-
mapproj=?ignore-before-r=3.5.0,
68-
multcomp=?ignore-before-r=3.5.0,
69-
quantreg=?ignore-before-r=3.5.0,
66+
quantreg=?ignore-before-r=3.6.0,
7067
needs: check
7168

7269
- uses: r-lib/actions/check-r-package@v2

NEWS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
* Fixed misbehaviour of `draw_key_boxplot()` and `draw_key_crossbar()` with
44
skewed key aspect ratio (@teunbrand, #5082).
5+
* Fixed a regression in `geom_hex()` where aesthetics were replicated across
6+
bins (@thomasp85, #5037 and #5044)
57
* Fixed spurious warning when `weight` aesthetic was used in `stat_smooth()`
68
(@teunbrand based on @clauswilke's suggestion, #5053).
79
* The `lwd` alias now correctly replaced by `linewidth` instead of `size`
810
(@teunbrand based on @clauswilke's suggestion #5051).
9-
11+
* Fixed a regression in `Coord$train_panel_guides()` where names of guides were
12+
dropped (@maxsutton, #5063)
13+
1014
# ggplot2 3.4.0
1115
This is a minor release focusing on tightening up the internals and ironing out
1216
some inconsistencies in the API. The biggest change is the addition of the

R/coord-.r

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ Coord <- ggproto("Coord",
158158

159159
train_panel_guides = function(self, panel_params, layers, default_mapping, params = list()) {
160160
aesthetics <- c("x", "y", "x.sec", "y.sec")
161-
names(aesthetics) <- aesthetics
161+
162162
# If the panel_params doesn't contain the scale, there's no guide for the aesthetic
163163
aesthetics <- intersect(aesthetics, names(panel_params$guides))
164+
165+
names(aesthetics) <- aesthetics
164166

165167
panel_params$guides <- lapply(aesthetics, function(aesthetic) {
166168
axis <- substr(aesthetic, 1, 1)

R/geom-hex.r

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@ GeomHex <- ggproto("GeomHex", Geom,
8080

8181
n <- nrow(data)
8282

83-
data <- data[rep(seq_len(n), each = 6), ]
84-
data$x <- rep.int(hexC$x, n) + data$x
85-
data$y <- rep.int(hexC$y, n) + data$y
83+
hexdata <- data[rep(seq_len(n), each = 6), c("x", "y")]
84+
hexdata$x <- rep.int(hexC$x, n) + hexdata$x
85+
hexdata$y <- rep.int(hexC$y, n) + hexdata$y
8686

87-
coords <- coord$transform(data, panel_params)
87+
coords <- coord$transform(hexdata, panel_params)
8888

8989
ggname("geom_hex", polygonGrob(
9090
coords$x, coords$y,
9191
gp = gpar(
92-
col = coords$colour,
93-
fill = alpha(coords$fill, coords$alpha),
94-
lwd = coords$linewidth * .pt,
95-
lty = coords$linetype,
92+
col = data$colour,
93+
fill = alpha(data$fill, data$alpha),
94+
lwd = data$linewidth * .pt,
95+
lty = data$linetype,
9696
lineend = lineend,
9797
linejoin = linejoin,
9898
linemitre = linemitre

R/save.r

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,24 @@ plot_dim <- function(dim = c(NA, NA), scale = 1, units = "in",
147147
}
148148

149149
if (limitsize && any(dim >= 50)) {
150+
units <- switch(
151+
units,
152+
"in" = "inches",
153+
"cm" = "centimeters",
154+
"mm" = "millimeters",
155+
"px" = "pixels"
156+
)
157+
msg <- paste0(
158+
"Dimensions exceed 50 inches ({.arg height} and {.arg width} are ",
159+
"specified in {.emph {units}}"
160+
)
161+
if (units == "pixels") {
162+
msg <- paste0(msg, ").")
163+
} else {
164+
msg <- paste0(msg, " not pixels).")
165+
}
150166
cli::cli_abort(c(
151-
"Dimensions exceed 50 inches ({.arg height} and {.arg width} are specified in {.emph {units}} not pixels).",
167+
msg,
152168
"i" = "If you're sure you want a plot that big, use {.code limitsize = FALSE}.
153169
"), call = call)
154170
}

R/scale-date.r

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
#' - A function that takes the limits as input and returns breaks as output
1616
#' @param date_breaks A string giving the distance between breaks like "2
1717
#' weeks", or "10 years". If both `breaks` and `date_breaks` are
18-
#' specified, `date_breaks` wins.
18+
#' specified, `date_breaks` wins. Valid specifications are 'sec', 'min',
19+
#' 'hour', 'day', 'week', 'month' or 'year', optionally followed by 's'.
1920
#' @param date_minor_breaks A string giving the distance between minor breaks
2021
#' like "2 weeks", or "10 years". If both `minor_breaks` and
21-
#' `date_minor_breaks` are specified, `date_minor_breaks` wins.
22+
#' `date_minor_breaks` are specified, `date_minor_breaks` wins. Valid
23+
#' specifications are 'sec', 'min', 'hour', 'day', 'week', 'month' or 'year',
24+
#' optionally followed by 's'.
2225
#' @param minor_breaks One of:
2326
#' - `NULL` for no breaks
2427
#' - `waiver()` for the breaks specified by `date_minor_breaks`
@@ -282,14 +285,14 @@ datetime_scale <- function(aesthetics, trans, palette,
282285

283286

284287
# Backward compatibility
285-
if (is.character(breaks)) breaks <- date_breaks(breaks)
286-
if (is.character(minor_breaks)) minor_breaks <- date_breaks(minor_breaks)
288+
if (is.character(breaks)) breaks <- breaks_width(breaks)
289+
if (is.character(minor_breaks)) minor_breaks <- breaks_width(minor_breaks)
287290

288291
if (!is.waive(date_breaks)) {
289-
breaks <- date_breaks(date_breaks)
292+
breaks <- breaks_width(date_breaks)
290293
}
291294
if (!is.waive(date_minor_breaks)) {
292-
minor_breaks <- date_breaks(date_minor_breaks)
295+
minor_breaks <- breaks_width(date_minor_breaks)
293296
}
294297
if (!is.waive(date_labels)) {
295298
labels <- function(self, x) {

man/scale_date.Rd

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)