Skip to content

Commit 6f452f4

Browse files
committed
resolve merge conflict
Merge branch 'main' into boilerplates # Conflicts: # R/geom-bin2d.R # R/geom-crossbar.R # R/geom-errorbar.R # R/geom-errorbarh.R # R/stat-bin.R # R/stat-ellipse.R # man/geom_errorbarh.Rd # man/geom_histogram.Rd # man/geom_linerange.Rd # man/ggplot2-ggproto.Rd
2 parents a68e4bb + 4193a50 commit 6f452f4

File tree

242 files changed

+3819
-2253
lines changed

Some content is hidden

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

242 files changed

+3819
-2253
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
cache-version: 3
6464
extra-packages: >
6565
any::rcmdcheck,
66-
Hmisc=?ignore-before-r=4.1.0,
66+
Hmisc=?ignore-before-r=4.2.0,
6767
quantreg=?ignore-before-r=4.3.0
6868
needs: check
6969

DESCRIPTION

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ggplot2
2-
Version: 3.5.1.9000
32
Title: Create Elegant Data Visualisations Using the Grammar of Graphics
3+
Version: 3.5.1.9000
44
Authors@R: c(
55
person("Hadley", "Wickham", , "[email protected]", role = "aut",
66
comment = c(ORCID = "0000-0003-4757-117X")),
@@ -30,21 +30,21 @@ License: MIT + file LICENSE
3030
URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2
3131
BugReports: https://github.com/tidyverse/ggplot2/issues
3232
Depends:
33-
R (>= 3.5)
33+
R (>= 4.0)
3434
Imports:
3535
cli,
3636
grDevices,
3737
grid,
3838
gtable (>= 0.1.1),
3939
isoband,
4040
lifecycle (> 1.0.1),
41-
MASS,
4241
rlang (>= 1.1.0),
4342
scales (>= 1.3.0),
4443
stats,
4544
vctrs (>= 0.6.0),
4645
withr (>= 2.5.0)
4746
Suggests:
47+
broom,
4848
covr,
4949
dplyr,
5050
ggplot2movies,
@@ -53,6 +53,7 @@ Suggests:
5353
knitr,
5454
mapproj,
5555
maps,
56+
MASS,
5657
mgcv,
5758
multcomp,
5859
munsell,
@@ -75,6 +76,7 @@ VignetteBuilder:
7576
knitr
7677
Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate
7778
Config/testthat/edition: 3
79+
Config/usethis/last-upkeep: 2024-10-24
7880
Encoding: UTF-8
7981
LazyData: true
8082
Roxygen: list(markdown = TRUE)
@@ -128,9 +130,8 @@ Collate:
128130
'facet-grid-.R'
129131
'facet-null.R'
130132
'facet-wrap.R'
131-
'fortify-lm.R'
132133
'fortify-map.R'
133-
'fortify-multcomp.R'
134+
'fortify-models.R'
134135
'fortify-spatial.R'
135136
'fortify.R'
136137
'stat-.R'
@@ -155,7 +156,6 @@ Collate:
155156
'geom-density2d.R'
156157
'geom-dotplot.R'
157158
'geom-errorbar.R'
158-
'geom-errorbarh.R'
159159
'geom-freqpoly.R'
160160
'geom-function.R'
161161
'geom-hex.R'

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2020 ggplot2 authors
3+
Copyright (c) 2024 ggplot2 core developer team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NAMESPACE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export(GeomAbline)
174174
export(GeomAnnotationMap)
175175
export(GeomArea)
176176
export(GeomBar)
177+
export(GeomBin2d)
177178
export(GeomBlank)
178179
export(GeomBoxplot)
179180
export(GeomCol)
@@ -463,7 +464,6 @@ export(guides)
463464
export(has_flipped_aes)
464465
export(is.Coord)
465466
export(is.coord)
466-
export(is.element)
467467
export(is.facet)
468468
export(is.geom)
469469
export(is.ggplot)
@@ -477,6 +477,8 @@ export(is.position)
477477
export(is.scale)
478478
export(is.stat)
479479
export(is.theme)
480+
export(is.theme_element)
481+
export(is.waiver)
480482
export(label_both)
481483
export(label_bquote)
482484
export(label_context)

NEWS.md

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

3+
* In non-orthogonal coordinate systems (`coord_sf()`, `coord_polar()` and
4+
`coord_radial()`), using 'AsIs' variables escape transformation when
5+
both `x` and `y` is an 'AsIs' variable (@teunbrand, #6205).
6+
* The following methods have been deprecated: `fortify.lm()`, `fortify.glht()`,
7+
`fortify.confint.glht()`, `fortify.summary.glht()` and `fortify.cld()`. It
8+
is recommend to use `broom::augment()` and `broom::tidy()` instead
9+
(@teunbrand, #3816).
10+
* Custom and raster annotation now respond to scale transformations, and can
11+
use AsIs variables for relative placement (@teunbrand based on
12+
@yutannihilation's prior work, #3120)
13+
* When discrete breaks have names, they'll be used as labels by default
14+
(@teunbrand, #6147).
15+
* The helper function `is.waiver()` is now exported to help extensions to work
16+
with `waiver()` objects (@arcresu, #6173).
17+
* Date(time) scales now throw appropriate errors when `date_breaks`,
18+
`date_minor_breaks` or `date_labels` are not strings (@RodDalBen, #5880)
19+
* `geom_errorbarh()` is deprecated in favour of
20+
`geom_errorbar(orientation = "y")` (@teunbrand, #5961).
21+
* `geom_contour()` should be able to recognise a rotated grid of points
22+
(@teunbrand, #4320)
23+
* `geom_boxplot()` gains additional arguments to style the colour, linetype and
24+
linewidths of the box, whiskers, median line and staples (@teunbrand, #5126)
25+
* (internal) Using `after_scale()` in the `Geom*$default_aes()` field is now
26+
evaluated in the context of data (@teunbrand, #6135)
27+
* Fixed bug where binned scales wouldn't simultaneously accept transformations
28+
and function-limits (@teunbrand, #6144).
329
* Fixed bug where the `ggplot2::`-prefix did not work with `stage()`
430
(@teunbrand, #6104).
531
* New `get_labs()` function for retrieving completed plot labels
@@ -184,6 +210,8 @@
184210
* The ellipsis argument is now checked in `fortify()`, `get_alt_text()`,
185211
`labs()` and several guides (@teunbrand, #3196).
186212
* `stat_summary_bin()` no longer ignores `width` parameter (@teunbrand, #4647).
213+
* Added `keep.zeroes` argument to `stat_bin()` (@teunbrand, #3449)
214+
* `coord_sf()` no longer errors when dealing with empty graticules (@teunbrand, #6052)
187215

188216
# ggplot2 3.5.1
189217

@@ -230,6 +258,7 @@ documentation updates.
230258
* `annotate()` now warns about `stat` or `position` arguments (@teunbrand, #5151)
231259
* `guide_coloursteps(even.steps = FALSE)` now works with discrete data that has
232260
been formatted by `cut()` (@teunbrand, #3877).
261+
* `ggsave()` now offers to install svglite if needed (@eliocamp, #6166).
233262

234263
# ggplot2 3.5.0
235264

R/annotation-custom.R

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,12 @@ GeomCustomAnn <- ggproto("GeomCustomAnn", Geom,
7070

7171
draw_panel = function(data, panel_params, coord, grob, xmin, xmax,
7272
ymin, ymax) {
73-
if (!inherits(coord, "CoordCartesian")) {
74-
cli::cli_abort("{.fn annotation_custom} only works with {.fn coord_cartesian}.")
75-
}
76-
corners <- data_frame0(
77-
x = c(xmin, xmax),
78-
y = c(ymin, ymax),
79-
.size = 2
73+
range <- ranges_annotation(
74+
coord, panel_params, xmin, xmax, ymin, ymax,
75+
fun = "annotation_custom"
8076
)
81-
data <- coord$transform(corners, panel_params)
82-
83-
x_rng <- range(data$x, na.rm = TRUE)
84-
y_rng <- range(data$y, na.rm = TRUE)
85-
86-
vp <- viewport(x = mean(x_rng), y = mean(y_rng),
87-
width = diff(x_rng), height = diff(y_rng),
77+
vp <- viewport(x = mean(range$x), y = mean(range$y),
78+
width = diff(range$x), height = diff(range$y),
8879
just = c("center","center"))
8980
editGrob(grob, vp = vp, name = paste(grob$name, annotation_id()))
9081
},
@@ -99,3 +90,21 @@ annotation_id <- local({
9990
i
10091
}
10192
})
93+
94+
ranges_annotation <- function(coord, panel_params, xmin, xmax, ymin, ymax, fun) {
95+
if (!inherits(coord, "CoordCartesian")) {
96+
cli::cli_abort("{.fn {fun}} only works with {.fn coord_cartesian}.")
97+
}
98+
data <- data_frame0(xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax)
99+
data <- .ignore_data(data)[[1]]
100+
x <- panel_params$x$scale$transform_df(data)
101+
data[names(x)] <- x
102+
y <- panel_params$y$scale$transform_df(data)
103+
data[names(y)] <- y
104+
data <- .expose_data(data)[[1]]
105+
data <- coord$transform(data, panel_params)
106+
list(
107+
x = range(data$xmin, data$xmax, na.rm = TRUE),
108+
y = range(data$ymin, data$ymax, na.rm = TRUE)
109+
)
110+
}

R/annotation-raster.R

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,13 @@ GeomRasterAnn <- ggproto("GeomRasterAnn", Geom,
7373

7474
draw_panel = function(data, panel_params, coord, raster, xmin, xmax,
7575
ymin, ymax, interpolate = FALSE) {
76-
if (!inherits(coord, "CoordCartesian")) {
77-
cli::cli_abort("{.fn annotation_raster} only works with {.fn coord_cartesian}.")
78-
}
79-
corners <- data_frame0(
80-
x = c(xmin, xmax),
81-
y = c(ymin, ymax),
82-
.size = 2
76+
range <- ranges_annotation(
77+
coord, panel_params, xmin, xmax, ymin, ymax,
78+
fun = "annotation_raster"
79+
)
80+
rasterGrob(raster, range$x[1], range$y[1],
81+
diff(range$x), diff(range$y), default.units = "native",
82+
just = c("left","bottom"), interpolate = interpolate
8383
)
84-
data <- coord$transform(corners, panel_params)
85-
86-
x_rng <- range(data$x, na.rm = TRUE)
87-
y_rng <- range(data$y, na.rm = TRUE)
88-
89-
rasterGrob(raster, x_rng[1], y_rng[1],
90-
diff(x_rng), diff(y_rng), default.units = "native",
91-
just = c("left","bottom"), interpolate = interpolate)
9284
}
9385
)

R/axis-secondary.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ is.sec_axis <- function(x) {
129129
}
130130

131131
set_sec_axis <- function(sec.axis, scale) {
132-
if (!is.waive(sec.axis)) {
132+
if (!is.waiver(sec.axis)) {
133133
if (scale$is_discrete()) {
134134
if (!identical(.subset2(sec.axis, "trans"), identity)) {
135135
cli::cli_abort("Discrete secondary axes must have the {.fn identity} transformation.")
@@ -182,11 +182,11 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
182182
if (!is.function(transform)) {
183183
cli::cli_abort("Transformation for secondary axes must be a function.")
184184
}
185-
if (is.derived(self$name) && !is.waive(scale$name)) self$name <- scale$name
185+
if (is.derived(self$name) && !is.waiver(scale$name)) self$name <- scale$name
186186
if (is.derived(self$breaks)) self$breaks <- scale$breaks
187-
if (is.waive(self$breaks)) {
187+
if (is.waiver(self$breaks)) {
188188
if (scale$is_discrete()) {
189-
self$breaks <- scale$get_breaks()
189+
self$breaks <- setNames(nm = scale$get_breaks())
190190
} else {
191191
breaks <- scale$get_transformation()$breaks
192192
n_breaks <- scale$n.breaks
@@ -235,7 +235,7 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
235235
self$mono_test(scale)
236236
breaks <- self$breaks
237237
} else {
238-
breaks <- scale$map(self$breaks)
238+
breaks <- setNames(scale$map(self$breaks), names(self$breaks))
239239
}
240240

241241
# Get scale's original range before transformation

R/backports.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ on_load({
6767
as.mask <- grid::as.mask
6868
}
6969
if ("linearGradient" %in% getNamespaceExports("grid")) {
70-
linearGradient <- grid::linearGradient()
70+
linearGradient <- grid::linearGradient
7171
}
7272
})

R/bin.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ bin_breaks <- function(breaks, closed = c("right", "left")) {
5454

5555
bin_breaks_width <- function(x_range, width = NULL, center = NULL,
5656
boundary = NULL, closed = c("right", "left")) {
57-
if (length(x_range) != 2) {
58-
cli::cli_abort("{.arg x_range} must have two elements.")
59-
}
57+
check_length(x_range, 2L)
6058

6159
# binwidth seems to be the argument name supplied to width. (stat-bin and stat-bindot)
6260
check_number_decimal(width, min = 0, allow_infinite = FALSE, arg = "binwidth")
@@ -106,9 +104,7 @@ bin_breaks_width <- function(x_range, width = NULL, center = NULL,
106104

107105
bin_breaks_bins <- function(x_range, bins = 30, center = NULL,
108106
boundary = NULL, closed = c("right", "left")) {
109-
if (length(x_range) != 2) {
110-
cli::cli_abort("{.arg x_range} must have two elements.")
111-
}
107+
check_length(x_range, 2L)
112108

113109
check_number_whole(bins, min = 1)
114110
if (zero_range(x_range)) {

0 commit comments

Comments
 (0)