Skip to content

Commit

Permalink
Release 3.4.0 (#5025)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 authored Oct 31, 2022
1 parent a58b48c commit 63125db
Show file tree
Hide file tree
Showing 80 changed files with 4,903 additions and 445 deletions.
6 changes: 2 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: ggplot2
Version: 3.3.6.9000
Version: 3.4.0
Title: Create Elegant Data Visualisations Using the Grammar of Graphics
Authors@R: c(
person("Hadley", "Wickham", , "[email protected]", role = "aut",
Expand Down Expand Up @@ -43,7 +43,7 @@ Imports:
scales (>= 1.2.0),
stats,
tibble,
vctrs (>= 0.4.1),
vctrs (>= 0.5.0),
withr (>= 2.5.0)
Suggests:
covr,
Expand Down Expand Up @@ -71,8 +71,6 @@ Suggests:
testthat (>= 3.1.2),
vdiffr (>= 1.0.0),
xml2
Remotes:
r-lib/lifecycle
Enhances:
sp
VignetteBuilder:
Expand Down
48 changes: 22 additions & 26 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@ S3method("$",ggproto)
S3method("$",ggproto_parent)
S3method("$<-",uneval)
S3method("+",gg)
S3method("[",mapped_discrete)
S3method("[",uneval)
S3method("[<-",mapped_discrete)
S3method("[<-",uneval)
S3method("[[",ggproto)
S3method("[[<-",uneval)
S3method(.DollarNames,ggproto)
S3method(as.data.frame,mapped_discrete)
S3method(as.list,ggproto)
S3method(autolayer,default)
S3method(autoplot,default)
S3method(c,mapped_discrete)
S3method(drawDetails,zeroGrob)
S3method(element_grob,element_blank)
S3method(element_grob,element_line)
S3method(element_grob,element_rect)
S3method(element_grob,element_text)
S3method(format,ggplot2_mapped_discrete)
S3method(format,ggproto)
S3method(format,ggproto_method)
S3method(fortify,"NULL")
Expand Down Expand Up @@ -139,30 +142,24 @@ S3method(scale_type,sfc)
S3method(single_value,default)
S3method(single_value,factor)
S3method(summary,ggplot)
S3method(vec_arith,ggplot2_mapped_discrete)
S3method(vec_arith.ggplot2_mapped_discrete,MISSING)
S3method(vec_arith.ggplot2_mapped_discrete,default)
S3method(vec_arith.ggplot2_mapped_discrete,ggplot2_mapped_discrete)
S3method(vec_arith.ggplot2_mapped_discrete,numeric)
S3method(vec_arith.numeric,ggplot2_mapped_discrete)
S3method(vec_cast,character.ggplot2_mapped_discrete)
S3method(vec_cast,double.ggplot2_mapped_discrete)
S3method(vec_cast,factor.ggplot2_mapped_discrete)
S3method(vec_cast,ggplot2_mapped_discrete.double)
S3method(vec_cast,ggplot2_mapped_discrete.factor)
S3method(vec_cast,ggplot2_mapped_discrete.ggplot2_mapped_discrete)
S3method(vec_cast,ggplot2_mapped_discrete.integer)
S3method(vec_cast,integer.ggplot2_mapped_discrete)
S3method(vec_math,ggplot2_mapped_discrete)
S3method(vec_ptype2,character.ggplot2_mapped_discrete)
S3method(vec_ptype2,double.ggplot2_mapped_discrete)
S3method(vec_ptype2,factor.ggplot2_mapped_discrete)
S3method(vec_ptype2,ggplot2_mapped_discrete.character)
S3method(vec_ptype2,ggplot2_mapped_discrete.double)
S3method(vec_ptype2,ggplot2_mapped_discrete.factor)
S3method(vec_ptype2,ggplot2_mapped_discrete.ggplot2_mapped_discrete)
S3method(vec_ptype2,ggplot2_mapped_discrete.integer)
S3method(vec_ptype2,integer.ggplot2_mapped_discrete)
S3method(vec_cast,character.mapped_discrete)
S3method(vec_cast,double.mapped_discrete)
S3method(vec_cast,factor.mapped_discrete)
S3method(vec_cast,integer.mapped_discrete)
S3method(vec_cast,mapped_discrete.double)
S3method(vec_cast,mapped_discrete.factor)
S3method(vec_cast,mapped_discrete.integer)
S3method(vec_cast,mapped_discrete.logical)
S3method(vec_cast,mapped_discrete.mapped_discrete)
S3method(vec_ptype2,character.mapped_discrete)
S3method(vec_ptype2,double.mapped_discrete)
S3method(vec_ptype2,factor.mapped_discrete)
S3method(vec_ptype2,integer.mapped_discrete)
S3method(vec_ptype2,mapped_discrete.character)
S3method(vec_ptype2,mapped_discrete.double)
S3method(vec_ptype2,mapped_discrete.factor)
S3method(vec_ptype2,mapped_discrete.integer)
S3method(vec_ptype2,mapped_discrete.mapped_discrete)
S3method(widthDetails,titleGrob)
S3method(widthDetails,zeroGrob)
export("%+%")
Expand Down Expand Up @@ -691,7 +688,6 @@ export(update_geom_defaults)
export(update_labels)
export(update_stat_defaults)
export(vars)
export(vec_arith.ggplot2_mapped_discrete)
export(waiver)
export(wrap_dims)
export(xlab)
Expand Down
127 changes: 80 additions & 47 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,64 @@
# ggplot2 (development version)
# ggplot2 3.4.0
This is a minor release focusing on tightening up the internals and ironing out
some inconsistencies in the API. The biggest change is the addition of the
`linewidth` aesthetic that takes of sizing the width of any line from `size`.
This change, while attempting to be as non-breaking as possible, has the
potential to change the look of some of your plots.

Other notable changes is a complete redo of the error and warning messaging in
ggplot2 using the cli package. Messaging is now better contextualised and it
should be easier to identify which layer an error is coming from. Last, we have
now made the switch to using the vctrs package internally which means that
support for vctrs classes as variables should improve, along with some small
gains in rendering speed.

## Breaking changes

* A `linewidth` aesthetic has been introduced and supersedes the `size`
aesthetic for scaling the width of lines in line based geoms. `size` will
remain functioning but deprecated for these geoms and it is recommended to
update all code to reflect the new aesthetic. For geoms that have _both_ point
sizing and linewidth sizing (`geom_pointrange()` and `geom_sf`) `size` now
**only** refers to sizing of points which can leads to a visual change in old
code (@thomasp85, #3672)

* The default line width for polygons in `geom_sf()` have been decreased to 0.2
to reflect that this is usually used for demarking borders where a thinner
line is better suited. This change was made since we already induced a
visual change in `geom_sf()` with the introduction of the `linewidth`
aesthetic.

* The dot-dot notation (`..var..`) and `stat()`, which have been superseded by
`after_stat()`, are now formally deprecated (@yutannihilation, #3693).

* `qplot()` is now formally deprecated (@yutannihilation, #3956).

* `stage()` now properly refers to the values without scale transformations for
the stage of `after_stat`. If your code requires the scaled version of the
values for some reason, you have to apply the same transformation by yourself,
e.g. `sqrt()` for `scale_{x,y}_sqrt()` (@yutannihilation and @teunbrand, #4155).

* Use `rlang::hash()` instead of `digest::digest()`. This update may lead to
changes in the automatic sorting of legends. In order to enforce a specific
legend order use the `order` argument in the guide. (@thomasp85, #4458)

* referring to `x` in backquoted expressions with `label_bquote()` is no longer
possible.

* The `ticks.linewidth` and `frame.linewidth` parameters of `guide_colourbar()`
are now multiplied with `.pt` like elsewhere in ggplot2. It can cause visual
changes when these arguments are not the defaults and these changes can be
restored to their previous behaviour by adding `/ .pt` (@teunbrand #4314).

* `scale_*_viridis_b()` now uses the full range of the viridis scales
(@gregleleu, #4737)

## New features

* `geom_col()` and `geom_bar()` gain a new `just` argument. This is set to `0.5`
by default; use `just = 0`/`just = 1` to place columns on the left/right
of the axis breaks.
(@wurli, #4899)

* Fix a bug in `position_jitter()` where infinity values were dropped (@javlon,
#4790).

* `geom_linerange()` now respects the `na.rm` argument (#4927, @thomasp85)

* Improve the support for `guide_axis()` on `coord_trans()` (@yutannihilation, #3959)

* `geom_density()` and `stat_density()` now support `bounds` argument
to estimate density with boundary correction (@echasnovski, #4013).
Expand All @@ -22,6 +67,25 @@
columns were dropped and warns about this. If stats intend to drop
data columns they can declare them in the new field `dropped_aes`.
(@clauswilke, #3250)

* `...` supports `rlang::list2` dynamic dots in all public functions.
(@mone27, #4764)

* `theme()` now has a `strip.clip` argument, that can be set to `"off"` to
prevent the clipping of strip text and background borders (@teunbrand, #4118)

* `geom_contour()` now accepts a function in the `breaks` argument
(@eliocamp, #4652).

## Minor improvements and bug fixes

* Fix a bug in `position_jitter()` where infinity values were dropped (@javlon,
#4790).

* `geom_linerange()` now respects the `na.rm` argument (#4927, @thomasp85)

* Improve the support for `guide_axis()` on `coord_trans()`
(@yutannihilation, #3959)

* Added `stat_align()` to align data without common x-coordinates prior to
stacking. This is now the default stat for `geom_area()` (@thomasp85, #4850)
Expand All @@ -30,26 +94,11 @@
certain number of digits would cause the computations to fail (@thomasp85,
#4874)

* `stage()` now properly refers to the values without scale transformations for
the stage of `after_stat`. If your code requires the scaled version of the
values for some reason, you have to apply the same transformation by yourself,
e.g. `sqrt()` for `scale_{x,y}_sqrt()` (@yutannihilation and @teunbrand, #4155).

* A `linewidth` aesthetic has been introduced and supersedes the `size`
aesthetic for scaling the width of lines in line based geoms. `size` will
remain functioning but deprecated for these geoms and it is recommended to
update all code to reflect the new aesthetic (@thomasp85, #3672)

* Secondary axis ticks are now positioned more precisely, removing small visual
artefacts with alignment between grid and ticks (@thomasp85, #3576)

* Improve `stat_function` documentation regarding `xlim` argument. (@92amartins, #4474)

* `qplot()` is now formally deprecated (@yutannihilation, #3956).

* Use `rlang::hash()` instead of `digest::digest()`. This update may lead to
changes in the automatic sorting of legends. In order to enforce a specific
legend order use the `order` argument in the guide. (@thomasp85, #4458)
* Improve `stat_function` documentation regarding `xlim` argument.
(@92amartins, #4474)

* Fix various issues with how `labels`, `breaks`, `limits`, and `show.limits`
interact in the different binning guides (@thomasp85, #4831)
Expand All @@ -62,11 +111,6 @@
If used incorrectly, the warning will now report the duplicated aesthetic
instead of `NA` (@teunbrand, #4707).

* `...` supports `rlang::list2` dynamic dots in all public functions. (@mone27, #4764)

* `theme()` now has a `strip.clip` argument, that can be set to `"off"` to
prevent the clipping of strip text and background borders (@teunbrand, #4118)

* `aes()` now supports the `!!!` operator in its first two arguments
(#2675). Thanks to @yutannihilation and @teunbrand for draft
implementations.
Expand All @@ -81,9 +125,6 @@

* `presidential` dataset now includes Trump's presidency (@bkmgit, #4703).

* referring to `x` in backquoted expressions with `label_bquote()` is no longer
possible.

* `position_stack()` now works fully with `geom_text()` (@thomasp85, #4367)

* `geom_tile()` now correctly recognises missing data in `xmin`, `xmax`, `ymin`,
Expand All @@ -106,8 +147,9 @@
* Binning scales are now more resilient to calculated limits that ends up being
`NaN` after transformations (@thomasp85, #4510)

* Strip padding in `facet_grid()` is now only in effect if `strip.placement = "outside"`
_and_ an axis is present between the strip and the panel (@thomasp85, #4610)
* Strip padding in `facet_grid()` is now only in effect if
`strip.placement = "outside"` _and_ an axis is present between the strip and
the panel (@thomasp85, #4610)

* Aesthetics of length 1 are now recycled to 0 if the length of the data is 0
(@thomasp85, #4588)
Expand All @@ -134,27 +176,18 @@
all `values` on the legend instead, use
`scale_*_manual(values = vals, limits = names(vals))`. (@teunbrand, @banfai,
#4511, #4534)

* `geom_contour()` now accepts a function in the `breaks` argument (@eliocamp, #4652).

* VISUAL CHANGE: `scale_*_viridis_b()` now uses the full range of the viridis scales (@gregleleu, #4737)

* Updated documentation for `geom_contour()` to correctly reflect argument
precedence between `bins` and `binwidth`. (@eliocamp, #4651)

* The `ticks.linewidth` and `frame.linewidth` parameters of `guide_colourbar()`
are now multiplied with `.pt` like elsewhere in ggplot2. It can cause visual
changes when these arguments are not the defaults and these changes can be
restored to their previous behaviour by adding `/ .pt` (@teunbrand #4314).
precedence between `bins` and `binwidth`. (@eliocamp, #4651)

* Dots in `geom_dotplot()` are now correctly aligned to the baseline when
`stackratio != 1` and `stackdir != "up"` (@mjskay, #4614)

* Key glyphs for `geom_boxplot()`, `geom_crossbar()`, `geom_pointrange()`, and
`geom_linerange()` are now orientation-aware (@mjskay, #4732)

* Updated documentation for `geom_smooth()` to more clearly describe effects of the
`fullrange` parameter (@thoolihan, #4399).
* Updated documentation for `geom_smooth()` to more clearly describe effects of
the `fullrange` parameter (@thoolihan, #4399).

# ggplot2 3.3.6
This is a very small release only applying an internal change to comply with
Expand Down
4 changes: 2 additions & 2 deletions R/aes-evaluation.r
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ is_calculated <- function(x, warn = FALSE) {
what <- I(glue("The dot-dot notation (`{x}`)"))
var <- gsub(match_calculated_aes, "\\1", as.character(x))
with <- I(glue("`after_stat({var})`"))
lifecycle::deprecate_warn("3.4.0", what, with, id = "ggplot-warn-aes-dot-dot")
deprecate_warn0("3.4.0", what, with, id = "ggplot-warn-aes-dot-dot")
}
res
} else if (is_quosure(x)) {
Expand All @@ -126,7 +126,7 @@ is_calculated <- function(x, warn = FALSE) {
what <- I(glue("`{expr_deparse(x)}`"))
x[[1]] <- quote(after_stat)
with <- I(glue("`{expr_deparse(x)}`"))
lifecycle::deprecate_warn("3.4.0", what, with, id = "ggplot-warn-aes-stat")
deprecate_warn0("3.4.0", what, with, id = "ggplot-warn-aes-stat")
}
TRUE
} else {
Expand Down
10 changes: 5 additions & 5 deletions R/aes.r
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ standardise_aes_symbols <- function(x) {

# Look up the scale that should be used for a given aesthetic
aes_to_scale <- function(var) {
var[var %in% c("x", "xmin", "xmax", "xend", "xintercept")] <- "x"
var[var %in% c("y", "ymin", "ymax", "yend", "yintercept")] <- "y"
var[var %in% ggplot_global$x_aes] <- "x"
var[var %in% ggplot_global$y_aes] <- "y"

var
}
Expand Down Expand Up @@ -265,7 +265,7 @@ is_position_aes <- function(vars) {
#'
#' @export
aes_ <- function(x, y, ...) {
lifecycle::deprecate_soft(
deprecate_soft0(
"3.0.0",
"aes_()",
details = "Please use tidy evaluation ideoms with `aes()`"
Expand All @@ -292,7 +292,7 @@ aes_ <- function(x, y, ...) {
#' @rdname aes_
#' @export
aes_string <- function(x, y, ...) {
lifecycle::deprecate_soft(
deprecate_soft0(
"3.0.0",
"aes_string()",
details = "Please use tidy evaluation ideoms with `aes()`"
Expand Down Expand Up @@ -346,7 +346,7 @@ aes_all <- function(vars) {
#' @keywords internal
#' @export
aes_auto <- function(data = NULL, ...) {
lifecycle::deprecate_warn("2.0.0", "aes_auto()")
deprecate_warn0("2.0.0", "aes_auto()")

# detect names of data
if (is.null(data)) {
Expand Down
2 changes: 1 addition & 1 deletion R/annotation.r
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ annotate <- function(geom, x = NULL, y = NULL, xmin = NULL, xmax = NULL,
ymin = NULL, ymax = NULL, xend = NULL, yend = NULL, ...,
na.rm = FALSE) {

if (geom %in% c("abline", "hline", "vline")) {
if (is.character(geom) && geom %in% c("abline", "hline", "vline")) {
cli::cli_warn(c(
"{.arg geom} must not be {.val {geom}}.",
"i" = "Please use {.fn {paste0('geom_', geom)}} directly instead."
Expand Down
4 changes: 2 additions & 2 deletions R/compat-plyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ count <- function(df, vars = NULL, wt_var = NULL) {
# Create a shared unique id across two data frames such that common variable
# combinations in the two data frames gets the same id
join_keys <- function(x, y, by) {
joint <- vec_rbind(x[by], y[by])
joint <- vec_rbind0(x[by], y[by])
keys <- id(joint, drop = TRUE)
n_x <- nrow(x)
n_y <- nrow(y)
Expand Down Expand Up @@ -298,7 +298,7 @@ dapply <- function(df, by, fun, ..., drop = TRUE) {
cur_data <- df_rows(df, group_rows[[i]])
apply_fun(cur_data)
})
vec_rbind(!!!result)
vec_rbind0(!!!result)
}

single_value <- function(x, ...) {
Expand Down
2 changes: 1 addition & 1 deletion R/coord-.r
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Coord <- ggproto("Coord",
labels = function(self, labels, panel_params) {
# If panel params contains guides information, use it.
# Otherwise use the labels as is, for backward-compatibility
if (is.null(panel_params$guide)) {
if (is.null(panel_params$guides)) {
return(labels)
}

Expand Down
Loading

0 comments on commit 63125db

Please sign in to comment.