Skip to content

Commit b4bbfdd

Browse files
committed
Merge branch 'main' into remove_aspect_ratio_warning
2 parents e1fa690 + 5f6d3c5 commit b4bbfdd

Some content is hidden

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

60 files changed

+524
-208
lines changed

NEWS.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
# ggplot2 (development version)
22

3-
### Bug fixes
4-
3+
* Fixed regression where `position_stack(vjust)` was ignored when there are
4+
only single groups (#6692)
5+
* Fixed bug where `NA` handling in `geom_path()` was ignoring panels (@teunbrand, #6533)
6+
* Logical values for the linetype aesthetic will be interpreted numerically,
7+
so that `linetype = FALSE` becomes 0/'blank' and `linetype = TRUE` becomes
8+
1/'solid' (@teunbrand, #6641)
9+
* Out-of-bounds datapoints used as padding by `stat_align()` now get removed
10+
silently rather than verbosely (@teunbrand, #6667)
11+
* Fixed bug where `stat_bin(boundary)` was ignored (#6682).
12+
* `geom_text()` and `geom_label()` accept expressions as the `label` aesthetic
13+
(@teunbrand, #6638)
514
* Fixed regression where `draw_key_rect()` stopped using `fill` colours
615
(@mitchelloharawild, #6609).
716
* Fixed regression where `scale_{x,y}_*()` threw an error when an expression
817
object is set to `labels` argument (@yutannihilation, #6617).
9-
10-
18+
* Improved palette fallback mechanism in scales (@teunbrand, #6669).
1119
* Allow `stat` in `geom_hline`, `geom_vline`, and `geom_abline`. (@sierrajohnson, #6559)
1220
* `stat_boxplot()` treats `width` as an optional aesthetic (@Yunuuuu, #6575)
21+
* Fixed regression where the first (unnamed) argument to colour/fill scales was
22+
not passed as the `name` argument (@teunbrand, #6623)
23+
* Fixed issue where vectorised `arrow()`s caused errors in drawing the
24+
legend glyphs (@teunbrand, #6594)
25+
* Fixed regression where `NULL`-aesthetics contributed to plot labels too
26+
insistently. Now they contribute only as fallback labels (@teunbrand, #6616)
1327

1428
# ggplot2 4.0.0
1529

R/aes-evaluation.R

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -346,26 +346,6 @@ strip_stage <- function(expr) {
346346
}
347347
}
348348

349-
# Convert aesthetic mapping into text labels
350-
make_labels <- function(mapping) {
351-
default_label <- function(aesthetic, mapping) {
352-
# e.g., geom_smooth(aes(colour = "loess")) or aes(y = NULL)
353-
if (is.null(mapping) || is.atomic(mapping)) {
354-
return(aesthetic)
355-
}
356-
mapping <- strip_stage(mapping)
357-
mapping <- strip_dots(mapping, strip_pronoun = TRUE)
358-
if (is_quosure(mapping) && quo_is_symbol(mapping)) {
359-
name <- as_string(quo_get_expr(mapping))
360-
} else {
361-
name <- quo_text(mapping)
362-
name <- gsub("\n.*$", "...", name)
363-
}
364-
name
365-
}
366-
Map(default_label, names(mapping), mapping)
367-
}
368-
369349
eval_aesthetics <- function(aesthetics, data, mask = NULL) {
370350

371351
env <- child_env(base_env())

R/bin.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ bin_breaks_bins <- function(x_range, bins = 30, center = NULL,
105105
} else {
106106
width <- (x_range[2] - x_range[1]) / (bins - 1)
107107
if (is.null(center)) {
108-
boundary <- boundary %||% x_range[1] - width / 2
108+
boundary <- boundary %||% (x_range[1] - width / 2)
109+
}
110+
# If `x_range` coincides with boundary we should
111+
# use exact `bins` instead of `bins - 1` to prevent misalignments.
112+
if (!is.null(boundary) && any(x_range %% width == boundary %% width)) {
113+
width <- (x_range[2] - x_range[1]) / bins
109114
}
110115
}
111116

R/fortify-map.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#' }
2929
fortify.map <- function(model, data, ...) {
3030
lifecycle::deprecate_warn(
31-
"3.6.0", I("`fortify(<map>)`"), "map_data()"
31+
"4.0.0", I("`fortify(<map>)`"), "map_data()"
3232
)
3333
df <- data_frame0(
3434
long = model$x,

R/fortify-models.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#' geom_point()
4040
fortify.lm <- function(model, data = model$model, ...) {
4141
lifecycle::deprecate_warn(
42-
"3.6.0", I("`fortify(<lm>)`"), I("`broom::augment(<lm>)`")
42+
"4.0.0", I("`fortify(<lm>)`"), I("`broom::augment(<lm>)`")
4343
)
4444
infl <- stats::influence(model, do.coef = FALSE)
4545
data$.hat <- infl$hat
@@ -102,7 +102,7 @@ NULL
102102
#' @export
103103
fortify.glht <- function(model, data, ...) {
104104
lifecycle::deprecate_warn(
105-
"3.6.0", I("`fortify(<glht>)`"), I("`broom::tidy(<glht>)`")
105+
"4.0.0", I("`fortify(<glht>)`"), I("`broom::tidy(<glht>)`")
106106
)
107107
base::data.frame(
108108
lhs = rownames(model$linfct),
@@ -118,7 +118,7 @@ fortify.glht <- function(model, data, ...) {
118118
#' @export
119119
fortify.confint.glht <- function(model, data, ...) {
120120
lifecycle::deprecate_warn(
121-
"3.6.0", I("`fortify(<confint.glht>)`"), I("`broom::tidy(<confint.glht>)`")
121+
"4.0.0", I("`fortify(<confint.glht>)`"), I("`broom::tidy(<confint.glht>)`")
122122
)
123123
coef <- model$confint
124124
colnames(coef) <- to_lower_ascii(colnames(coef))
@@ -137,7 +137,7 @@ fortify.confint.glht <- function(model, data, ...) {
137137
#' @export
138138
fortify.summary.glht <- function(model, data, ...) {
139139
lifecycle::deprecate_warn(
140-
"3.6.0", I("`fortify(<summary.glht>)`"), I("`broom::tidy(<summary.glht>)`")
140+
"4.0.0", I("`fortify(<summary.glht>)`"), I("`broom::tidy(<summary.glht>)`")
141141
)
142142
coef <- as.data.frame(
143143
model$test[c("coefficients", "sigma", "tstat", "pvalues")])
@@ -158,7 +158,7 @@ fortify.summary.glht <- function(model, data, ...) {
158158
#' @export
159159
fortify.cld <- function(model, data, ...) {
160160
lifecycle::deprecate_warn(
161-
"3.6.0", I("`fortify(<summary.glht>)`"), I("`broom::tidy(<summary.glht>)`")
161+
"4.0.0", I("`fortify(<summary.glht>)`"), I("`broom::tidy(<summary.glht>)`")
162162
)
163163
base::data.frame(
164164
lhs = names(model$mcletters$Letters),

R/geom-label.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ GeomLabel <- ggproto("GeomLabel", Geom,
8383
if (parse) {
8484
lab <- parse_safe(as.character(lab))
8585
}
86+
lab <- validate_labels(lab)
8687

8788
data <- coord$transform(data, panel_params)
8889
data$vjust <- compute_just(data$vjust, data$y, data$x, data$angle)

R/geom-path.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ GeomPath <- ggproto("GeomPath", Geom,
1919
# middle since you expect those to be shown by a break in the line
2020
aesthetics <- c(self$required_aes, self$non_missing_aes)
2121
complete <- stats::complete.cases(data[names(data) %in% aesthetics])
22-
kept <- stats::ave(complete, data$group, FUN = keep_mid_true)
22+
kept <- stats::ave(complete, data$group, data$PANEL, FUN = keep_mid_true)
2323
data <- data[kept, ]
2424

2525
if (!all(kept) && !params$na.rm) {

R/geom-text.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ GeomText <- ggproto(
2323
if (parse) {
2424
lab <- parse_safe(as.character(lab))
2525
}
26+
lab <- validate_labels(lab)
2627

2728
data <- coord$transform(data, panel_params)
2829

R/geom-violin.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
#' @param quantile.colour,quantile.color,quantile.linewidth,quantile.linetype
2525
#' Default aesthetics for the quantile lines. Set to `NULL` to inherit from
2626
#' the data's aesthetics. By default, quantile lines are hidden and can be
27-
#' turned on by changing `quantile.linetype`.
27+
#' turned on by changing `quantile.linetype`. Quantile values can be set
28+
#' using the `quantiles` argument when using `stat = "ydensity"` (default).
2829
#' @param draw_quantiles `r lifecycle::badge("deprecated")` Previous
2930
#' specification of drawing quantiles.
3031
#' @export

R/guide-colorbar.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ NULL
4545
#' @param available_aes A vector of character strings listing the aesthetics
4646
#' for which a colourbar can be drawn.
4747
#' @param ... ignored.
48+
#' @details
49+
#' The `legend.ticks.length` theme option can be set to a length 2 unit to
50+
#' control ticks at the right/bottom and left/top sides independently.
51+
#'
4852
#' @return A guide object
4953
#' @export
5054
#' @family guides

0 commit comments

Comments
 (0)