Skip to content

Release 3.4.0 #5025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6860142
remove lifecycle dev requirement
thomasp85 Sep 20, 2022
f46a042
move recent deprecations to soft
thomasp85 Sep 20, 2022
b67f0f6
Fix bug in pointrange key drawing
thomasp85 Sep 20, 2022
57f8fae
fix issues with vctrs coercion in empty layers
thomasp85 Sep 20, 2022
a5c4123
Reintruoduce vars as an actual function in ggplot2
thomasp85 Sep 20, 2022
9c9ac75
Avoid revdep issues when passing through NULL to switch
thomasp85 Sep 21, 2022
7d8579c
avoid selecting unknown column due to linewidth switch
thomasp85 Sep 21, 2022
40a4fbd
avoid error when assiging NA to mapped_discrete
thomasp85 Sep 23, 2022
26f3f90
remove attributes from input
thomasp85 Sep 23, 2022
9f75c34
make sure to rename size in default_aes
thomasp85 Sep 23, 2022
cc4ff9b
Avoid check is geom is passed as ggproto object
thomasp85 Sep 29, 2022
4b7acf5
Fallback to use size if linewidth is missing in input data
thomasp85 Sep 29, 2022
a76022a
Roll back changes to mapped_discrete
thomasp85 Oct 4, 2022
9bec3f6
avoid adding the `spec_tbl_df` class to presidential
thomasp85 Oct 4, 2022
07c503c
avoid dropping attributes as some revdeps rely on names for indexing
thomasp85 Oct 5, 2022
157afff
Make sure NULL defaults to "fixed"
thomasp85 Oct 7, 2022
62a826d
provide correct versioning
thomasp85 Oct 7, 2022
101c3a6
make sure custom transform methods are not circumvented
thomasp85 Oct 7, 2022
075170c
don't warn on weight
thomasp85 Oct 7, 2022
d5db1f3
Fix partial matching
thomasp85 Oct 10, 2022
e93e053
avoid dropped aes warning
thomasp85 Oct 10, 2022
a9c316d
Use a less strict version of vec_rbind to accomodate revdeps while al…
thomasp85 Oct 11, 2022
c181f9b
Avoid problems when domain transformation results in NaN as e.g. log1p
thomasp85 Oct 11, 2022
7c16b18
allow numerics with attributes in mapped_discrete
thomasp85 Oct 11, 2022
6425de8
mapped_discrete are now always doubles and we need to include test fo…
thomasp85 Oct 11, 2022
2ae2c92
Update vctrs version
thomasp85 Oct 23, 2022
76c9e58
Avoid returning NULL limit
thomasp85 Oct 24, 2022
9da8a92
make vignettes current
thomasp85 Oct 25, 2022
5eb1e1a
change sf polygon linewidth default to 0.2
thomasp85 Oct 26, 2022
2f30c08
Catch use of |> due to different precedence rules that %>%
thomasp85 Oct 26, 2022
3ac9a31
Make sure the user_env is correctly available to deprecation messages
thomasp85 Oct 31, 2022
04d402c
fetch x and y aesthetics from ggplot_globals
thomasp85 Oct 31, 2022
4294ee2
reverse meaning of just
thomasp85 Oct 31, 2022
bf8de52
turn off partial match check temporarily
thomasp85 Oct 31, 2022
d70a57d
update lifecycle
thomasp85 Oct 31, 2022
a38f2ee
update linewidth description
thomasp85 Oct 31, 2022
032d5ac
polish note
thomasp85 Oct 31, 2022
bcbe661
run revdepcheck
thomasp85 Oct 31, 2022
b99b711
update cran-comment
thomasp85 Oct 31, 2022
205431f
update snapshot for deprecation
thomasp85 Oct 31, 2022
4176f73
Increment version number to 3.4.0
thomasp85 Oct 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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