Skip to content

Commit c9f1460

Browse files
authored
Merge branch 'main' into fix_pseudo_log_ticks
2 parents 073dc11 + 3914e13 commit c9f1460

File tree

272 files changed

+12302
-6176
lines changed

Some content is hidden

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

272 files changed

+12302
-6176
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ jobs:
3535
clean = FALSE,
3636
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3737
)
38+
print(cov)
3839
covr::to_cobertura(cov)
3940
shell: Rscript {0}
4041

41-
- uses: codecov/codecov-action@v4
42+
- uses: codecov/codecov-action@v5
4243
with:
43-
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
44-
file: ./cobertura.xml
45-
plugin: noop
44+
# Fail if error if not on PR, or if on PR and token is given
45+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
46+
files: ./cobertura.xml
47+
plugins: noop
4648
disable_search: true
4749
token: ${{ secrets.CODECOV_TOKEN }}
4850

DESCRIPTION

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Authors@R: c(
2020
comment = c(ORCID = "0000-0002-9415-4582")),
2121
person("Teun", "van den Brand", role = "aut",
2222
comment = c(ORCID = "0000-0002-9335-7468")),
23-
person("Posit, PBC", role = c("cph", "fnd"))
23+
person("Posit, PBC", role = c("cph", "fnd"),
24+
comment = c(ROR = "03wc8by49"))
2425
)
2526
Description: A system for 'declaratively' creating graphics, based on "The
2627
Grammar of Graphics". You provide the data, tell 'ggplot2' how to map
@@ -30,7 +31,7 @@ License: MIT + file LICENSE
3031
URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2
3132
BugReports: https://github.com/tidyverse/ggplot2/issues
3233
Depends:
33-
R (>= 4.0)
34+
R (>= 4.1)
3435
Imports:
3536
cli,
3637
grDevices,
@@ -63,6 +64,7 @@ Suggests:
6364
ragg (>= 1.2.6),
6465
RColorBrewer,
6566
rmarkdown,
67+
roxygen2,
6668
rpart,
6769
sf (>= 0.7-3),
6870
svglite (>= 2.1.2),
@@ -76,7 +78,7 @@ VignetteBuilder:
7678
knitr
7779
Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate
7880
Config/testthat/edition: 3
79-
Config/usethis/last-upkeep: 2024-10-24
81+
Config/usethis/last-upkeep: 2025-04-23
8082
Encoding: UTF-8
8183
LazyData: true
8284
Roxygen: list(markdown = TRUE)
@@ -93,11 +95,15 @@ Collate:
9395
'compat-plyr.R'
9496
'utilities.R'
9597
'aes.R'
98+
'annotation-borders.R'
9699
'utilities-checks.R'
97100
'legend-draw.R'
98101
'geom-.R'
99102
'annotation-custom.R'
100103
'annotation-logticks.R'
104+
'scale-type.R'
105+
'layer.R'
106+
'make-constructor.R'
101107
'geom-polygon.R'
102108
'geom-map.R'
103109
'annotation-map.R'
@@ -142,6 +148,7 @@ Collate:
142148
'geom-col.R'
143149
'geom-path.R'
144150
'geom-contour.R'
151+
'geom-point.R'
145152
'geom-count.R'
146153
'geom-crossbar.R'
147154
'geom-segment.R'
@@ -160,7 +167,6 @@ Collate:
160167
'geom-jitter.R'
161168
'geom-label.R'
162169
'geom-linerange.R'
163-
'geom-point.R'
164170
'geom-pointrange.R'
165171
'geom-quantile.R'
166172
'geom-rug.R'
@@ -186,7 +192,6 @@ Collate:
186192
'guide-colorbar.R'
187193
'guide-colorsteps.R'
188194
'guide-custom.R'
189-
'layer.R'
190195
'guide-none.R'
191196
'guide-old.R'
192197
'guides-.R'
@@ -236,7 +241,6 @@ Collate:
236241
'scale-shape.R'
237242
'scale-size.R'
238243
'scale-steps.R'
239-
'scale-type.R'
240244
'scale-view.R'
241245
'scale-viridis.R'
242246
'scales-.R'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2024
1+
YEAR: 2025
22
COPYRIGHT HOLDER: ggplot2 core developer team

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) 2024 ggplot2 core developer team
3+
Copyright (c) 2025 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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ S3method(element_grob,element_rect)
2828
S3method(element_grob,element_text)
2929
S3method(format,ggproto)
3030
S3method(format,ggproto_method)
31+
S3method(format,rd_section_aesthetics)
3132
S3method(fortify,"NULL")
3233
S3method(fortify,"function")
3334
S3method(fortify,Line)
@@ -95,6 +96,8 @@ S3method(limits,character)
9596
S3method(limits,factor)
9697
S3method(limits,numeric)
9798
S3method(makeContext,dotstackGrob)
99+
S3method(make_constructor,Geom)
100+
S3method(make_constructor,Stat)
98101
S3method(merge_element,default)
99102
S3method(merge_element,element)
100103
S3method(merge_element,element_blank)
@@ -168,6 +171,7 @@ export(CoordQuickmap)
168171
export(CoordRadial)
169172
export(CoordSf)
170173
export(CoordTrans)
174+
export(CoordTransform)
171175
export(Facet)
172176
export(FacetGrid)
173177
export(FacetNull)
@@ -294,6 +298,7 @@ export(after_scale)
294298
export(after_stat)
295299
export(alpha)
296300
export(annotate)
301+
export(annotation_borders)
297302
export(annotation_custom)
298303
export(annotation_logticks)
299304
export(annotation_map)
@@ -322,6 +327,7 @@ export(coord_quickmap)
322327
export(coord_radial)
323328
export(coord_sf)
324329
export(coord_trans)
330+
export(coord_transform)
325331
export(cut_interval)
326332
export(cut_number)
327333
export(cut_width)
@@ -474,7 +480,6 @@ export(is.facet)
474480
export(is.ggplot)
475481
export(is.ggproto)
476482
export(is.theme)
477-
export(is.waiver)
478483
export(is_coord)
479484
export(is_facet)
480485
export(is_geom)
@@ -490,6 +495,7 @@ export(is_scale)
490495
export(is_stat)
491496
export(is_theme)
492497
export(is_theme_element)
498+
export(is_waiver)
493499
export(label_both)
494500
export(label_bquote)
495501
export(label_context)
@@ -505,6 +511,7 @@ export(layer_grob)
505511
export(layer_scales)
506512
export(layer_sf)
507513
export(lims)
514+
export(make_constructor)
508515
export(map_data)
509516
export(margin)
510517
export(margin_auto)

NEWS.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
* Better handling of the `guide_axis_logticks(negative.small)` parameter when
44
scale limits have small maximum (@teunbrand, #6121).
55
* Fixed bug where the `ggplot2::`-prefix did not work with `stage()`
6+
* New roxygen tag `@aesthetics` that takes a Geom, Stat or Position class and
7+
generates an 'Aesthetics' section.
8+
* `annotation_borders()` replaces the now-deprecated `borders()`
9+
(@teunbrand, #6392)
10+
* New `make_constructor()` function that builds a standard constructor for
11+
Geom and Stat classes (@teunbrand, #6142).
12+
* In continuous scales, when `breaks` is a function and `n.breaks` is set, the
13+
`n.breaks` will be passed to the `breaks` function. Previously, `n.breaks`
14+
only applied to the default break calculation (@teunbrand, #5972)
615
* (internal) New `Facet$draw_panel_content()` method for delegating panel
716
assembly (@Yunuuuu, #6406).
817
* Facet gains a new method `setup_panel_params` to interact with the
@@ -92,7 +101,7 @@
92101
@yutannihilation's prior work, #3120)
93102
* When discrete breaks have names, they'll be used as labels by default
94103
(@teunbrand, #6147).
95-
* The helper function `is.waiver()` is now exported to help extensions to work
104+
* The helper function `is_waiver()` is now exported to help extensions to work
96105
with `waiver()` objects (@arcresu, #6173).
97106
* Date(time) scales now throw appropriate errors when `date_breaks`,
98107
`date_minor_breaks` or `date_labels` are not strings (@RodDalBen, #5880)
@@ -283,6 +292,7 @@
283292
(@teunbrand, #5938, #4327).
284293
* Fixed bug where empty discrete scales weren't recognised as such
285294
(@teunbrand, #5945).
295+
* `coord_trans()` renamed to `coord_transform()` (@nmercadeb, #5825).
286296
* (internal) The summary function of `stat_summary()` and `stat_summary_bin()`
287297
is setup once in total instead of once per group (@teunbrand, #5971)
288298
* `facet_grid(space = "free")` can now be combined with `coord_fixed()`

R/aes.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ aes_ <- function(x, y, ...) {
302302
caller_env <- parent.frame()
303303

304304
as_quosure_aes <- function(x) {
305-
if (is.formula(x) && length(x) == 2) {
305+
if (is_formula(x) && length(x) == 2) {
306306
as_quosure(x)
307307
} else if (is.null(x) || is.call(x) || is.name(x) || is.atomic(x)) {
308308
new_aesthetic(x, caller_env)

R/annotation-borders.R

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#' Create a layer of map borders
2+
#'
3+
#' This is a quick and dirty way to get map data (from the \pkg{maps} package)
4+
#' onto your plot. This is a good place to start if you need some crude
5+
#' reference lines, but you'll typically want something more sophisticated
6+
#' for communication graphics.
7+
#'
8+
#' @param database map data, see [maps::map()] for details
9+
#' @param regions map region
10+
#' @param fill fill colour
11+
#' @param colour border colour
12+
#' @param xlim,ylim latitudinal and longitudinal ranges for extracting map
13+
#' polygons, see [maps::map()] for details.
14+
#' @inheritDotParams geom_polygon
15+
#' @export
16+
#' @examples
17+
#' if (require("maps")) {
18+
#' data(us.cities)
19+
#' capitals <- subset(us.cities, capital == 2)
20+
#' ggplot(capitals, aes(long, lat)) +
21+
#' annotation_borders("state") +
22+
#' geom_point(aes(size = pop)) +
23+
#' scale_size_area() +
24+
#' coord_quickmap()
25+
#' }
26+
#'
27+
#' if (require("maps")) {
28+
#' # Same map, with some world context
29+
#' ggplot(capitals, aes(long, lat)) +
30+
#' annotation_borders("world", xlim = c(-130, -60), ylim = c(20, 50)) +
31+
#' geom_point(aes(size = pop)) +
32+
#' scale_size_area() +
33+
#' coord_quickmap()
34+
#' }
35+
annotation_borders <- function(database = "world", regions = ".", fill = NA,
36+
colour = "grey50", xlim = NULL, ylim = NULL, ...) {
37+
df <- map_data(database, regions, xlim = xlim, ylim = ylim)
38+
annotate(
39+
geom = "polygon",
40+
x = df$long, y = df$lat, group = df$group,
41+
fill = fill, colour = colour, ...
42+
)
43+
}
44+
45+
#' @export
46+
#' @rdname annotation_borders
47+
#' @usage borders(...) # Deprecated
48+
borders <- function(...) {
49+
deprecate_soft0("4.0.0", "borders()", "annotation_borders()")
50+
annotation_borders(...)
51+
}

R/annotation-custom.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ annotation_custom <- function(grob, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax =
5858
)
5959
}
6060

61-
#' @rdname ggplot2-ggproto
61+
#' @rdname Geom
6262
#' @format NULL
6363
#' @usage NULL
6464
#' @export

R/annotation-logticks.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#' @param scaled is the data already log-scaled? This should be `TRUE`
2525
#' (default) when the data is already transformed with `log10()` or when
2626
#' using `scale_y_log10()`. It should be `FALSE` when using
27-
#' `coord_trans(y = "log10")`.
27+
#' `coord_transform(y = "log10")`.
2828
#' @param colour Colour of the tick marks.
2929
#' @param linewidth Thickness of tick marks, in mm.
3030
#' @param linetype Linetype of tick marks (`solid`, `dashed`, etc.)
@@ -36,18 +36,18 @@
3636
#' @export
3737
#' @seealso [scale_y_continuous()], [scale_y_log10()] for log scale
3838
#' transformations.
39-
#' @seealso [coord_trans()] for log coordinate transformations.
39+
#' @seealso [coord_transform()] for log coordinate transformations.
4040
#'
4141
#' @examples
4242
#' # Make a log-log plot (without log ticks)
4343
#' a <- ggplot(msleep, aes(bodywt, brainwt)) +
4444
#' geom_point(na.rm = TRUE) +
4545
#' scale_x_log10(
46-
#' breaks = scales::trans_breaks("log10", function(x) 10^x),
46+
#' breaks = scales::trans_breaks("log10", \(x) 10^x),
4747
#' labels = scales::trans_format("log10", scales::math_format(10^.x))
4848
#' ) +
4949
#' scale_y_log10(
50-
#' breaks = scales::trans_breaks("log10", function(x) 10^x),
50+
#' breaks = scales::trans_breaks("log10", \(x) 10^x),
5151
#' labels = scales::trans_format("log10", scales::math_format(10^.x))
5252
#' ) +
5353
#' theme_bw()
@@ -75,7 +75,7 @@
7575
#' # Using a coordinate transform requires scaled = FALSE
7676
#' t <- ggplot(msleep, aes(bodywt, brainwt)) +
7777
#' geom_point() +
78-
#' coord_trans(x = "log10", y = "log10") +
78+
#' coord_transform(x = "log10", y = "log10") +
7979
#' theme_bw()
8080
#' t + annotation_logticks(scaled = FALSE)
8181
#'
@@ -93,6 +93,8 @@ annotation_logticks <- function(base = 10, sides = "bl", outside = FALSE, scaled
9393
if (!is.null(color))
9494
colour <- color
9595

96+
lifecycle::signal_stage("superseded", "annotation_logticks()", "guide_axis_logticks()")
97+
9698
if (lifecycle::is_present(size)) {
9799
deprecate_soft0("3.5.0", I("Using the `size` aesthetic in this geom"), I("`linewidth`"))
98100
linewidth <- linewidth %||% size
@@ -123,7 +125,7 @@ annotation_logticks <- function(base = 10, sides = "bl", outside = FALSE, scaled
123125
)
124126
}
125127

126-
#' @rdname ggplot2-ggproto
128+
#' @rdname Geom
127129
#' @format NULL
128130
#' @usage NULL
129131
#' @export

0 commit comments

Comments
 (0)