Skip to content

Commit 89316f6

Browse files
committed
fix merge conflict
Merge branch 'main' into n_breaks_for_all # Conflicts: # R/scale-.R
2 parents 6fedc16 + 183e7ad commit 89316f6

File tree

338 files changed

+25933
-26785
lines changed

Some content is hidden

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

338 files changed

+25933
-26785
lines changed

DESCRIPTION

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Imports:
3535
cli,
3636
grDevices,
3737
grid,
38-
gtable (>= 0.1.1),
38+
gtable (>= 0.3.6),
3939
isoband,
4040
lifecycle (> 1.0.1),
4141
rlang (>= 1.1.0),
@@ -242,10 +242,12 @@ Collate:
242242
'scales-.R'
243243
'stat-align.R'
244244
'stat-bin.R'
245+
'stat-summary-2d.R'
245246
'stat-bin2d.R'
246247
'stat-bindot.R'
247248
'stat-binhex.R'
248249
'stat-boxplot.R'
250+
'stat-connect.R'
249251
'stat-contour.R'
250252
'stat-count.R'
251253
'stat-density-2d.R'
@@ -254,6 +256,7 @@ Collate:
254256
'stat-ellipse.R'
255257
'stat-function.R'
256258
'stat-identity.R'
259+
'stat-manual.R'
257260
'stat-qq-line.R'
258261
'stat-qq.R'
259262
'stat-quantilemethods.R'
@@ -262,7 +265,6 @@ Collate:
262265
'stat-smooth-methods.R'
263266
'stat-smooth.R'
264267
'stat-sum.R'
265-
'stat-summary-2d.R'
266268
'stat-summary-bin.R'
267269
'stat-summary-hex.R'
268270
'stat-summary.R'
@@ -273,6 +275,7 @@ Collate:
273275
'theme.R'
274276
'theme-defaults.R'
275277
'theme-current.R'
278+
'theme-sub.R'
276279
'utilities-break.R'
277280
'utilities-grid.R'
278281
'utilities-help.R'

NAMESPACE

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ S3method("[[",ggproto)
1313
S3method("[[<-",uneval)
1414
S3method(.DollarNames,ggproto)
1515
S3method(as.data.frame,mapped_discrete)
16+
S3method(as.gtable,ggplot)
17+
S3method(as.gtable,ggplot_built)
1618
S3method(as.list,ggproto)
1719
S3method(autolayer,default)
1820
S3method(autoplot,default)
1921
S3method(c,mapped_discrete)
2022
S3method(drawDetails,zeroGrob)
2123
S3method(element_grob,element_blank)
2224
S3method(element_grob,element_line)
25+
S3method(element_grob,element_point)
26+
S3method(element_grob,element_polygon)
2327
S3method(element_grob,element_rect)
2428
S3method(element_grob,element_text)
2529
S3method(format,ggproto)
@@ -94,6 +98,7 @@ S3method(makeContext,dotstackGrob)
9498
S3method(merge_element,default)
9599
S3method(merge_element,element)
96100
S3method(merge_element,element_blank)
101+
S3method(merge_element,margin)
97102
S3method(pattern_alpha,GridPattern)
98103
S3method(pattern_alpha,GridTilingPattern)
99104
S3method(pattern_alpha,default)
@@ -254,6 +259,7 @@ export(StatBin2d)
254259
export(StatBindot)
255260
export(StatBinhex)
256261
export(StatBoxplot)
262+
export(StatConnect)
257263
export(StatContour)
258264
export(StatContourFilled)
259265
export(StatCount)
@@ -264,6 +270,7 @@ export(StatEcdf)
264270
export(StatEllipse)
265271
export(StatFunction)
266272
export(StatIdentity)
273+
export(StatManual)
267274
export(StatQq)
268275
export(StatQqLine)
269276
export(StatQuantile)
@@ -344,6 +351,8 @@ export(element_blank)
344351
export(element_geom)
345352
export(element_grob)
346353
export(element_line)
354+
export(element_point)
355+
export(element_polygon)
347356
export(element_rect)
348357
export(element_render)
349358
export(element_text)
@@ -494,6 +503,8 @@ export(layer_sf)
494503
export(lims)
495504
export(map_data)
496505
export(margin)
506+
export(margin_auto)
507+
export(margin_part)
497508
export(max_height)
498509
export(max_width)
499510
export(mean_cl_boot)
@@ -676,6 +687,7 @@ export(stat_bin_2d)
676687
export(stat_bin_hex)
677688
export(stat_binhex)
678689
export(stat_boxplot)
690+
export(stat_connect)
679691
export(stat_contour)
680692
export(stat_contour_filled)
681693
export(stat_count)
@@ -688,6 +700,7 @@ export(stat_ecdf)
688700
export(stat_ellipse)
689701
export(stat_function)
690702
export(stat_identity)
703+
export(stat_manual)
691704
export(stat_qq)
692705
export(stat_qq_line)
693706
export(stat_quantile)
@@ -720,8 +733,18 @@ export(theme_linedraw)
720733
export(theme_minimal)
721734
export(theme_replace)
722735
export(theme_set)
736+
export(theme_sub_axis)
737+
export(theme_sub_axis_bottom)
738+
export(theme_sub_axis_left)
739+
export(theme_sub_axis_right)
740+
export(theme_sub_axis_top)
741+
export(theme_sub_axis_x)
742+
export(theme_sub_axis_y)
743+
export(theme_sub_legend)
744+
export(theme_sub_panel)
745+
export(theme_sub_plot)
746+
export(theme_sub_strip)
723747
export(theme_test)
724-
export(theme_transparent)
725748
export(theme_update)
726749
export(theme_void)
727750
export(transform_position)

NEWS.md

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

3+
* `position_fill()` avoids stacking observations of zero (@teunbrand, #6338)
4+
* New `layer(layout)` argument to interact with facets (@teunbrand, #3062)
5+
* New `stat_connect()` to connect points via steps or other shapes
6+
(@teunbrand, #6228)
7+
* Fixed regression with incorrectly drawn gridlines when using `coord_flip()`
8+
(@teunbrand, #6293).
9+
* Deprecated functions and arguments prior to ggplot2 3.0.0 throw errors instead
10+
of warnings.
11+
* Functions and arguments that were soft-deprecated up to ggplot2 3.4.0 now
12+
throw warnings.
13+
* (internal) layer data can be attenuated with parameter attributes
14+
(@teunbrand, #3175).
15+
* Date scales silently coerce <POSIXct> to <Date> and datetime scales silently
16+
coerce <Date> to <POSIXct> (@laurabrianna, #3533)
17+
* New parameters for `geom_label()` (@teunbrand and @steveharoz, #5365):
18+
* The `linewidth` aesthetic is now applied and replaces the `label.size`
19+
argument.
20+
* The `linetype` aesthetic is now applied.
21+
* New `border.colour` argument to set the colour of borders.
22+
* New `text.colour` argument to set the colour of text.
23+
* New `element_point()` and `element_polygon()` that can be given to
24+
`theme(point, polygon)` as an extension point (@teunbrand, #6248).
25+
* Turned off fallback for `size` to `linewidth` translation in
26+
`geom_bar()`/`geom_col()` (#4848).
27+
* `coord_radial()` now displays no axis instead of throwing an error when
28+
a scale has no breaks (@teunbrand, #6271).
29+
* The `fatten` argument has been deprecated in `geom_boxplot()`,
30+
`geom_crossbar()` and `geom_pointrange()` (@teunbrand, #4881).
31+
* Axis labels are now preserved better when using `coord_sf(expand = TRUE)` and
32+
graticule lines are straight but do not meet the edge (@teunbrand, #2985).
33+
* Attempt to boost detail in `coord_polar()` and `coord_radial()` near the
34+
center (@teunbrand, #5023)
35+
* Scale names, guide titles and aesthetic labels can now accept functions
36+
(@teunbrand, #4313)
37+
* Binned scales with zero-width data expand the default limits by 0.1
38+
(@teunbrand, #5066)
39+
* New default `geom_qq_line(geom = "abline")` for better clipping in the
40+
vertical direction. In addition, `slope` and `intercept` are new computed
41+
variables in `stat_qq_line()` (@teunbrand, #6087).
42+
* Position adjustments can now have auxiliary aesthetics (@teunbrand).
43+
* `position_nudge()` gains `nudge_x` and `nudge_y` aesthetics (#3026, #5445).
44+
* `position_dodge()` gains `order` aesthetic (#3022, #3345)
45+
* More stability for vctrs-based palettes (@teunbrand, #6117).
46+
* Fixed regression in `guide_bins(reverse = TRUE)` (@teunbrand, #6183).
47+
* New function family for setting parts of a theme. For example, you can now use
48+
`theme_sub_axis(line, text, ticks, ticks.length, line)` as a substitute for
49+
`theme(axis.line, axis.text, axis.ticks, axis.ticks.length, axis.line)`. This
50+
should allow slightly terser and more organised theme declarations
51+
(@teunbrand, #5301).
52+
* `scale_{x/y}_discrete(continuous.limits)` is a new argument to control the
53+
display range of discrete scales (@teunbrand, #4174, #6259).
54+
* `geom_ribbon()` now appropriately warns about, and removes, missing values
55+
(@teunbrand, #6243).
56+
* `guide_*()` can now accept two inside legend theme elements:
57+
`legend.position.inside` and `legend.justification.inside`, allowing inside
58+
legends to be placed at different positions. Only inside legends with the same
59+
position and justification will be merged (@Yunuuuu, #6210).
60+
* New stat: `stat_manual()` for arbitrary computations (@teunbrand, #3501)
61+
* Reversal of a dimension, typically 'x' or 'y', is now controlled by the
62+
`reverse` argument in `coord_cartesian()`, `coord_fixed()`, `coord_radial()`
63+
and `coord_sf()`. In `coord_radial()`, this replaces the older `direction`
64+
argument (#4021, @teunbrand).
65+
* `coord_radial()` displays minor gridlines now (@teunbrand).
66+
* (internal) `continuous_scale()` and `binned_scale()` sort the `limits`
67+
argument internally (@teunbrand).
68+
* Theme margins can have NA-units to inherit from parent elements. The new
69+
function `margin_part()` has NA-units as default (@teunbrand, #6115)
70+
* New `margin_auto()` specification for theme margins.
71+
* New argument `labs(dictionary)` to label based on variable name rather than
72+
based on aesthetic (@teunbrand, #5178)
73+
* Fixed bug in out-of-bounds binned breaks (@teunbrand, #6054)
374
* Binned guides now accept expressions as labels (@teunbrand, #6005)
475
* (internal) `Scale$get_labels()` format expressions as lists.
576
* In non-orthogonal coordinate systems (`coord_sf()`, `coord_polar()` and
@@ -24,6 +95,13 @@
2495
(@teunbrand, #4320)
2596
* `geom_boxplot()` gains additional arguments to style the colour, linetype and
2697
linewidths of the box, whiskers, median line and staples (@teunbrand, #5126)
98+
* `geom_violin()` gains additional arguments to style the colour, linetype and
99+
linewidths of the quantiles, which replace the now-deprecated `draw_quantiles`
100+
argument (#5912).
101+
* (breaking) `geom_violin(quantiles)` now has actual quantiles based on
102+
the data, rather than inferred quantiles based on the computed density. The
103+
`quantiles` parameter that replaces `draw_quantiles` now belongs to
104+
`stat_ydensity()` instead of `geom_violin()` (@teunbrand, #4120).
27105
* (internal) Using `after_scale()` in the `Geom*$default_aes()` field is now
28106
evaluated in the context of data (@teunbrand, #6135)
29107
* Fixed bug where binned scales wouldn't simultaneously accept transformations
@@ -175,8 +253,8 @@
175253
and (non-text) margins inherit from (@teunbrand, #5622).
176254
* `geom_ribbon()` can have varying `fill` or `alpha` in linear coordinate
177255
systems (@teunbrand, #4690).
178-
* `geom_tile()` computes default widths and heights per panel instead of
179-
per layer (@teunbrand, #5740).
256+
* `geom_tile()` and `position_jitter()` computes default widths and heights
257+
per panel instead of per layer (@teunbrand, #5740, #3722).
180258
* The `fill` of the `panel.border` theme setting is ignored and forced to be
181259
transparent (#5782).
182260
* `stat_align()` skips computation when there is only 1 group and therefore
@@ -206,18 +284,62 @@
206284
is setup once in total instead of once per group (@teunbrand, #5971)
207285
* `facet_grid(space = "free")` can now be combined with `coord_fixed()`
208286
(@teunbrand, #4584).
209-
* `theme_classic()` now has black ticks and text instead of dark gray. In
210-
addition, `theme_classic()`'s axis line end is `"square"` (@teunbrand, #5978).
287+
* `theme_classic()` has the following changes (@teunbrand, #5978 & #6320):
288+
* Axis ticks are now black (`ink`-coloured) instead of dark gray.
289+
* Axis line ends are now `"square"`.
290+
* The panel grid is now blank at the `panel.grid` hierarchy level instead of
291+
the `panel.grid.major` and `panel.grid.minor` levels.
211292
* {tibble} is now suggested instead of imported (@teunbrand, #5986)
212293
* The ellipsis argument is now checked in `fortify()`, `get_alt_text()`,
213294
`labs()` and several guides (@teunbrand, #3196).
214295
* `stat_summary_bin()` no longer ignores `width` parameter (@teunbrand, #4647).
215-
* Added `keep.zeroes` argument to `stat_bin()` (@teunbrand, #3449)
296+
* Reintroduced `drop` argument to `stat_bin()` (@teunbrand, #3449)
297+
* (internal) removed barriers for using 2D structures as aesthetics
298+
(@teunbrand, #4189).
216299
* `coord_sf()` no longer errors when dealing with empty graticules (@teunbrand, #6052)
217300
* Added `theme_transparent()` with transparent backgrounds (@topepo).
218301
* New theme elements `palette.{aes}.discrete` and `palette.{aes}.continuous`.
219302
Theme palettes replace palettes in scales where `palette = NULL`, which is
220303
the new default in many scales (@teunbrand, #4696).
304+
* `guide_axis()` no longer reserves space for blank ticks
305+
(@teunbrand, #4722, #6069).
306+
* `geom_abline()` clips to the panel range in the vertical direction too
307+
(@teunbrand, #6086).
308+
* Added `panel.widths` and `panel.heights` to `theme()` (#5338, @teunbrand).
309+
* Standardised the calculation of `width`, which are now implemented as
310+
aesthetics (@teunbrand, #2800).
311+
* Stricter check on `register_theme_elements(element_tree)` (@teunbrand, #6162)
312+
* Added `weight` aesthetic for `stat_ellipse()` (@teunbrand, #5272)
313+
* Fixed a bug where the `guide_custom(order)` wasn't working (@teunbrand, #6195)
314+
* All binning stats now use the `boundary`/`center` parametrisation rather
315+
than `origin`, following in `stat_bin()`'s footsteps (@teunbrand).
316+
* `stat_summary_2d()` and `stat_bin_2d()` now deal with zero-range data
317+
more elegantly (@teunbrand, #6207).
318+
* Munching in `coord_polar()` and `coord_radial()` now adds more detail,
319+
particularly for data-points with a low radius near the center
320+
(@teunbrand, #5023).
321+
* All scales now expose the `aesthetics` parameter (@teunbrand, #5841)
322+
* Staged expressions are handled more gracefully if legends cannot resolve them
323+
(@teunbrand, #6264).
324+
* New `theme(legend.key.justification)` to control the alignment of legend keys
325+
(@teunbrand, #3669).
326+
* Added `scale_{x/y}_time(date_breaks, date_minor_breaks, date_labels)`
327+
(@teunbrand, #4335).
328+
* (internal) `legend.key.width` and `legend.key.height` calculations are no
329+
longer precomputed before guides are drawn (@teunbrand, #6339)
330+
* `ggsave()` can write a multi-page pdf file when provided with a list of plots
331+
(@teunbrand, #5093).
332+
* (internal) When `validate_subclass()` fails to find a class directly, it tries
333+
to retrieve the class via constructor functions (@teunbrand).
334+
* (internal) The ViewScale class has a `make_fixed_copy()` method to permit
335+
copying trained position scales (#3441).
336+
* `draw_key_rect()` replaces a `NA` fill by the `colour` aesthetic and
337+
`draw_key_polygon()` has 0 linewidth as internal default (@teunbrand, #5385).
338+
* Improved consistency of curve direction in `geom_curve()` (@teunbrand, #5069)
339+
* `linetype = NA` is now interpreted to mean 'no line' instead of raising errors
340+
(@teunbrand, #6269).
341+
* The default colour and fill scales have a new `palette` argument
342+
(@teunbrand, #6064).
221343

222344
# ggplot2 3.5.1
223345

R/aes.R

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ NULL
3838
#'
3939
#' [Delayed evaluation][aes_eval] for working with computed variables.
4040
#'
41+
#' @note
42+
#' Using `I()` to create objects of class 'AsIs' causes scales to ignore the
43+
#' variable and assumes the wrapped variable is direct input for the grid
44+
#' package. Please be aware that variables are sometimes combined, like in
45+
#' some stats or position adjustments, that may yield unexpected results with
46+
#' 'AsIs' variables.
47+
#'
4148
#' @family aesthetics documentation
4249
#' @return A list with class `uneval`. Components of the list are either
4350
#' quosures or constants.
@@ -283,7 +290,7 @@ is_position_aes <- function(vars) {
283290
#'
284291
#' @export
285292
aes_ <- function(x, y, ...) {
286-
deprecate_soft0(
293+
deprecate_warn0(
287294
"3.0.0",
288295
"aes_()",
289296
details = "Please use tidy evaluation idioms with `aes()`"
@@ -310,7 +317,7 @@ aes_ <- function(x, y, ...) {
310317
#' @rdname aes_
311318
#' @export
312319
aes_string <- function(x, y, ...) {
313-
deprecate_soft0(
320+
deprecate_warn0(
314321
"3.0.0",
315322
"aes_string()",
316323
details = c(
@@ -353,7 +360,7 @@ aes_all <- function(vars) {
353360
# refer to the data mask
354361
structure(
355362
lapply(vars, function(x) new_quosure(as.name(x), emptyenv())),
356-
class = "uneval"
363+
class = c("unlabelled_uneval", "uneval")
357364
)
358365
}
359366

@@ -367,29 +374,7 @@ aes_all <- function(vars) {
367374
#' @keywords internal
368375
#' @export
369376
aes_auto <- function(data = NULL, ...) {
370-
deprecate_warn0("2.0.0", "aes_auto()")
371-
372-
# detect names of data
373-
if (is.null(data)) {
374-
cli::cli_abort("{.fn aes_auto} requires a {.cls data.frame} or names of data.frame.")
375-
} else if (is.data.frame(data)) {
376-
vars <- names(data)
377-
} else {
378-
vars <- data
379-
}
380-
381-
# automatically detected aes
382-
vars <- intersect(ggplot_global$all_aesthetics, vars)
383-
names(vars) <- vars
384-
aes <- lapply(vars, function(x) parse(text = x)[[1]])
385-
386-
# explicitly defined aes
387-
if (length(match.call()) > 2) {
388-
args <- as.list(match.call()[-1])
389-
aes <- c(aes, args[names(args) != "data"])
390-
}
391-
392-
structure(rename_aes(aes), class = "uneval")
377+
lifecycle::deprecate_stop("2.0.0", "aes_auto()")
393378
}
394379

395380
mapped_aesthetics <- function(x) {

R/annotation-custom.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ GeomCustomAnn <- ggproto("GeomCustomAnn", Geom,
8080
editGrob(grob, vp = vp, name = paste(grob$name, annotation_id()))
8181
},
8282

83-
default_aes = aes_(xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
83+
default_aes = aes(xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
8484
)
8585

8686
annotation_id <- local({

R/annotation-logticks.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ GeomLogticks <- ggproto("GeomLogticks", Geom,
229229
},
230230

231231
default_aes = aes(
232-
colour = from_theme(ink),
232+
colour = from_theme(colour %||% ink),
233233
linewidth = from_theme(linewidth),
234234
linetype = from_theme(linetype),
235235
alpha = 1

0 commit comments

Comments
 (0)