Skip to content

Commit b91bb9c

Browse files
committed
resolve merge conflict
Merge branch 'main' into S7_objects # Conflicts: # DESCRIPTION # NAMESPACE # R/guide-.R # R/guide-axis-theta.R # R/labels.R # R/theme-elements.R # R/theme.R # man/is_tests.Rd
2 parents c843860 + 7fb5760 commit b91bb9c

File tree

280 files changed

+12631
-6241
lines changed

Some content is hidden

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

280 files changed

+12631
-6241
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,
@@ -64,6 +65,7 @@ Suggests:
6465
ragg (>= 1.2.6),
6566
RColorBrewer,
6667
rmarkdown,
68+
roxygen2,
6769
rpart,
6870
sf (>= 0.7-3),
6971
svglite (>= 2.1.2),
@@ -77,7 +79,7 @@ VignetteBuilder:
7779
knitr
7880
Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate
7981
Config/testthat/edition: 3
80-
Config/usethis/last-upkeep: 2024-10-24
82+
Config/usethis/last-upkeep: 2025-04-23
8183
Encoding: UTF-8
8284
LazyData: true
8385
Roxygen: list(markdown = TRUE)
@@ -95,11 +97,15 @@ Collate:
9597
'utilities.R'
9698
'aes.R'
9799
'all-classes.R'
100+
'annotation-borders.R'
98101
'utilities-checks.R'
99102
'legend-draw.R'
100103
'geom-.R'
101104
'annotation-custom.R'
102105
'annotation-logticks.R'
106+
'scale-type.R'
107+
'layer.R'
108+
'make-constructor.R'
103109
'geom-polygon.R'
104110
'geom-map.R'
105111
'annotation-map.R'
@@ -144,6 +150,7 @@ Collate:
144150
'geom-col.R'
145151
'geom-path.R'
146152
'geom-contour.R'
153+
'geom-point.R'
147154
'geom-count.R'
148155
'geom-crossbar.R'
149156
'geom-segment.R'
@@ -162,7 +169,6 @@ Collate:
162169
'geom-jitter.R'
163170
'geom-label.R'
164171
'geom-linerange.R'
165-
'geom-point.R'
166172
'geom-pointrange.R'
167173
'geom-quantile.R'
168174
'geom-rug.R'
@@ -190,7 +196,6 @@ Collate:
190196
'guide-colorbar.R'
191197
'guide-colorsteps.R'
192198
'guide-custom.R'
193-
'layer.R'
194199
'guide-none.R'
195200
'guide-old.R'
196201
'guides-.R'
@@ -239,7 +244,6 @@ Collate:
239244
'scale-shape.R'
240245
'scale-size.R'
241246
'scale-steps.R'
242-
'scale-type.R'
243247
'scale-view.R'
244248
'scale-viridis.R'
245249
'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
@@ -31,6 +31,7 @@ S3method(c,mapped_discrete)
3131
S3method(drawDetails,zeroGrob)
3232
S3method(format,ggproto)
3333
S3method(format,ggproto_method)
34+
S3method(format,rd_section_aesthetics)
3435
S3method(fortify,"NULL")
3536
S3method(fortify,"function")
3637
S3method(fortify,Line)
@@ -75,6 +76,8 @@ S3method(limits,character)
7576
S3method(limits,factor)
7677
S3method(limits,numeric)
7778
S3method(makeContext,dotstackGrob)
79+
S3method(make_constructor,Geom)
80+
S3method(make_constructor,Stat)
7881
S3method(pattern_alpha,GridPattern)
7982
S3method(pattern_alpha,GridTilingPattern)
8083
S3method(pattern_alpha,default)
@@ -142,6 +145,7 @@ export(CoordQuickmap)
142145
export(CoordRadial)
143146
export(CoordSf)
144147
export(CoordTrans)
148+
export(CoordTransform)
145149
export(Facet)
146150
export(FacetGrid)
147151
export(FacetNull)
@@ -268,6 +272,7 @@ export(after_scale)
268272
export(after_stat)
269273
export(alpha)
270274
export(annotate)
275+
export(annotation_borders)
271276
export(annotation_custom)
272277
export(annotation_logticks)
273278
export(annotation_map)
@@ -301,6 +306,7 @@ export(coord_quickmap)
301306
export(coord_radial)
302307
export(coord_sf)
303308
export(coord_trans)
309+
export(coord_transform)
304310
export(cut_interval)
305311
export(cut_number)
306312
export(cut_width)
@@ -454,7 +460,6 @@ export(is.facet)
454460
export(is.ggplot)
455461
export(is.ggproto)
456462
export(is.theme)
457-
export(is.waiver)
458463
export(is_coord)
459464
export(is_facet)
460465
export(is_geom)
@@ -470,6 +475,7 @@ export(is_scale)
470475
export(is_stat)
471476
export(is_theme)
472477
export(is_theme_element)
478+
export(is_waiver)
473479
export(label_both)
474480
export(label_bquote)
475481
export(label_context)
@@ -485,6 +491,7 @@ export(layer_grob)
485491
export(layer_scales)
486492
export(layer_sf)
487493
export(lims)
494+
export(make_constructor)
488495
export(map_data)
489496
export(margin)
490497
export(margin_auto)

NEWS.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# ggplot2 (development version)
22

3+
* New `coord_cartesian(ratio)` argument that absorbs the aspect ratio
4+
functionality from `coord_equal()` and `coord_fixed()`, which are now
5+
wrappers for `coord_cartesian()`.
6+
* Better handling of the `guide_axis_logticks(negative.small)` parameter when
7+
scale limits have small maximum (@teunbrand, #6121).
8+
* Fixed bug where the `ggplot2::`-prefix did not work with `stage()`
9+
* New roxygen tag `@aesthetics` that takes a Geom, Stat or Position class and
10+
generates an 'Aesthetics' section.
11+
* `annotation_borders()` replaces the now-deprecated `borders()`
12+
(@teunbrand, #6392)
13+
* New `make_constructor()` function that builds a standard constructor for
14+
Geom and Stat classes (@teunbrand, #6142).
15+
* In continuous scales, when `breaks` is a function and `n.breaks` is set, the
16+
`n.breaks` will be passed to the `breaks` function. Previously, `n.breaks`
17+
only applied to the default break calculation (@teunbrand, #5972)
318
* (internal) New `Facet$draw_panel_content()` method for delegating panel
419
assembly (@Yunuuuu, #6406).
520
* Facet gains a new method `setup_panel_params` to interact with the
@@ -89,7 +104,7 @@
89104
@yutannihilation's prior work, #3120)
90105
* When discrete breaks have names, they'll be used as labels by default
91106
(@teunbrand, #6147).
92-
* The helper function `is.waiver()` is now exported to help extensions to work
107+
* The helper function `is_waiver()` is now exported to help extensions to work
93108
with `waiver()` objects (@arcresu, #6173).
94109
* Date(time) scales now throw appropriate errors when `date_breaks`,
95110
`date_minor_breaks` or `date_labels` are not strings (@RodDalBen, #5880)
@@ -280,6 +295,7 @@
280295
(@teunbrand, #5938, #4327).
281296
* Fixed bug where empty discrete scales weren't recognised as such
282297
(@teunbrand, #5945).
298+
* `coord_trans()` renamed to `coord_transform()` (@nmercadeb, #5825).
283299
* (internal) The summary function of `stat_summary()` and `stat_summary_bin()`
284300
is setup once in total instead of once per group (@teunbrand, #5971)
285301
* `facet_grid(space = "free")` can now be combined with `coord_fixed()`
@@ -340,6 +356,8 @@
340356
(@teunbrand, #6269).
341357
* The default colour and fill scales have a new `palette` argument
342358
(@teunbrand, #6064).
359+
* The `theme(legend.spacing.{x/y})` setting now accepts `null`-units
360+
(@teunbrand, #6417).
343361

344362
# ggplot2 3.5.2
345363

R/aes.R

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

296296
as_quosure_aes <- function(x) {
297-
if (is.formula(x) && length(x) == 2) {
297+
if (is_formula(x) && length(x) == 2) {
298298
as_quosure(x)
299299
} else if (is.null(x) || is.call(x) || is.name(x) || is.atomic(x)) {
300300
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)