Skip to content

Commit 39fe78e

Browse files
committed
resolve merge conflict
Merge branch 'main' into flex_legend_size # Conflicts: # R/guide-legend.R # R/guides-.R # R/plot-build.R
2 parents beb6e64 + e51ca46 commit 39fe78e

File tree

265 files changed

+6970
-1228
lines changed

Some content is hidden

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

265 files changed

+6970
-1228
lines changed

DESCRIPTION

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Imports:
4040
MASS,
4141
mgcv,
4242
rlang (>= 1.1.0),
43-
scales (>= 1.2.0),
43+
scales (>= 1.3.0),
4444
stats,
4545
tibble,
4646
vctrs (>= 0.5.0),
@@ -115,6 +115,7 @@ Collate:
115115
'coord-munch.R'
116116
'coord-polar.R'
117117
'coord-quickmap.R'
118+
'coord-radial.R'
118119
'coord-sf.R'
119120
'coord-transform.R'
120121
'data.R'
@@ -174,10 +175,14 @@ Collate:
174175
'grouping.R'
175176
'guide-.R'
176177
'guide-axis.R'
178+
'guide-axis-logticks.R'
179+
'guide-axis-stack.R'
180+
'guide-axis-theta.R'
177181
'guide-legend.R'
178182
'guide-bins.R'
179183
'guide-colorbar.R'
180184
'guide-colorsteps.R'
185+
'guide-custom.R'
181186
'layer.R'
182187
'guide-none.R'
183188
'guide-old.R'
@@ -270,6 +275,7 @@ Collate:
270275
'utilities-grid.R'
271276
'utilities-help.R'
272277
'utilities-matrix.R'
278+
'utilities-patterns.R'
273279
'utilities-resolution.R'
274280
'utilities-tidy-eval.R'
275281
'zxx.R'

NAMESPACE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
S3method("$",ggproto)
44
S3method("$",ggproto_parent)
5+
S3method("$",theme)
56
S3method("$<-",uneval)
67
S3method("+",gg)
78
S3method("[",mapped_discrete)
@@ -94,6 +95,10 @@ S3method(makeContext,dotstackGrob)
9495
S3method(merge_element,default)
9596
S3method(merge_element,element)
9697
S3method(merge_element,element_blank)
98+
S3method(pattern_alpha,GridPattern)
99+
S3method(pattern_alpha,GridTilingPattern)
100+
S3method(pattern_alpha,default)
101+
S3method(pattern_alpha,list)
97102
S3method(plot,ggplot)
98103
S3method(predictdf,default)
99104
S3method(predictdf,glm)
@@ -147,6 +152,8 @@ S3method(widthDetails,zeroGrob)
147152
export("%+%")
148153
export("%+replace%")
149154
export(.data)
155+
export(.expose_data)
156+
export(.ignore_data)
150157
export(.pt)
151158
export(.stroke)
152159
export(AxisSecondary)
@@ -157,6 +164,7 @@ export(CoordFlip)
157164
export(CoordMap)
158165
export(CoordPolar)
159166
export(CoordQuickmap)
167+
export(CoordRadial)
160168
export(CoordSf)
161169
export(CoordTrans)
162170
export(Facet)
@@ -211,9 +219,12 @@ export(GeomViolin)
211219
export(GeomVline)
212220
export(Guide)
213221
export(GuideAxis)
222+
export(GuideAxisLogticks)
223+
export(GuideAxisStack)
214224
export(GuideBins)
215225
export(GuideColourbar)
216226
export(GuideColoursteps)
227+
export(GuideCustom)
217228
export(GuideLegend)
218229
export(GuideNone)
219230
export(GuideOld)
@@ -302,6 +313,7 @@ export(coord_map)
302313
export(coord_munch)
303314
export(coord_polar)
304315
export(coord_quickmap)
316+
export(coord_radial)
305317
export(coord_sf)
306318
export(coord_trans)
307319
export(cut_interval)
@@ -348,6 +360,7 @@ export(expr)
348360
export(facet_grid)
349361
export(facet_null)
350362
export(facet_wrap)
363+
export(fill_alpha)
351364
export(find_panel)
352365
export(flip_data)
353366
export(flipped_names)
@@ -418,11 +431,15 @@ export(ggproto_parent)
418431
export(ggsave)
419432
export(ggtitle)
420433
export(guide_axis)
434+
export(guide_axis_logticks)
435+
export(guide_axis_stack)
436+
export(guide_axis_theta)
421437
export(guide_bins)
422438
export(guide_colorbar)
423439
export(guide_colorsteps)
424440
export(guide_colourbar)
425441
export(guide_coloursteps)
442+
export(guide_custom)
426443
export(guide_gengrob)
427444
export(guide_geom)
428445
export(guide_legend)
@@ -466,6 +483,7 @@ export(new_guide)
466483
export(old_guide)
467484
export(panel_cols)
468485
export(panel_rows)
486+
export(pattern_alpha)
469487
export(position_dodge)
470488
export(position_dodge2)
471489
export(position_fill)
@@ -703,3 +721,5 @@ importFrom(lifecycle,deprecated)
703721
importFrom(stats,setNames)
704722
importFrom(tibble,tibble)
705723
importFrom(utils,.DollarNames)
724+
importFrom(utils,head)
725+
importFrom(utils,tail)

NEWS.md

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

3+
* `draw_key_label()` now better reflects the appearance of labels.
4+
5+
* The `minor_breaks` function argument in scales can now take a function with
6+
two arguments: the scale's limits and the scale's major breaks (#3583).
7+
8+
* (internal) The `ScaleContinuous$get_breaks()` method no longer censors
9+
the computed breaks.
10+
11+
* Plot scales now ignore `AsIs` objects constructed with `I(x)`, instead of
12+
invoking the identity scale. This allows these columns to co-exist with other
13+
layers that need a non-identity scale for the same aesthetic. Also, it makes
14+
it easy to specify relative positions (@teunbrand, #5142).
15+
16+
* The `fill` aesthetic in many geoms now accepts grid's patterns and gradients.
17+
For developers of layer extensions, this feature can be enabled by switching
18+
from `fill = alpha(fill, alpha)` to `fill = fill_alpha(fill, alpha)` when
19+
providing fills to `grid::gpar()` (@teunbrand, #3997).
20+
21+
* The plot's title, subtitle and caption now obey horizontal text margins
22+
(#5533).
23+
24+
* New `guide_axis_stack()` to combine other axis guides on top of one another.
25+
26+
* New `guide_custom()` function for drawing custom graphical objects (grobs)
27+
unrelated to scales in legend positions (#5416).
28+
29+
* `theme()` now supports splicing a list of arguments (#5542).
30+
31+
* Contour functions will not fail when `options("OutDec")` is not `.` (@eliocamp, #5555).
32+
33+
* The `legend.key` theme element is set to inherit from the `panel.background`
34+
theme element. The default themes no longer set the `legend.key` element.
35+
This causes a visual change with the default `theme_gray()` (#5549).
36+
37+
* Lines where `linewidth = NA` are now dropped in `geom_sf()` (#5204).
38+
39+
* New `guide_axis_logticks()` can be used to draw logarithmic tick marks as
40+
an axis. It supersedes the `annotation_logticks()` function
41+
(@teunbrand, #5325).
42+
43+
* Glyphs drawing functions of the `draw_key_*()` family can now set `"width"`
44+
and `"height"` attributes (in centimetres) to the produced keys to control
45+
their displayed size in the legend.
46+
47+
* `coord_radial()` is a successor to `coord_polar()` with more customisation
48+
options. `coord_radial()` can:
49+
50+
* integrate with the new guide system via a dedicated `guide_axis_theta()` to
51+
display the angle coordinate.
52+
* in addition to drawing full circles, also draw circle sectors by using the
53+
`end` argument.
54+
* avoid data vanishing in the center of the plot by setting the `donut`
55+
argument.
56+
* adjust the `angle` aesthetic of layers, such as `geom_text()`, to align
57+
with the coordinate system using the `rotate_angle` argument.
58+
59+
* By default, `guide_legend()` now only draws a key glyph for a layer when
60+
the value is is the layer's data. To revert to the old behaviour, you
61+
can still set `show.legend = c({aesthetic} = TRUE)` (@teunbrand, #3648).
62+
63+
* The spacing between legend keys and their labels, in addition to legends
64+
and their titles, is now controlled by the text's `margin` setting. Not
65+
specifying margins will automatically add appropriate text margins. To
66+
control the spacing within a legend between keys, the new
67+
`key.spacing.{x/y}` argument can be used. This leaves the
68+
`legend.spacing` dedicated to controlling the spacing between
69+
different guides (#5455).
70+
71+
* In the theme element hierarchy, parent elements that are a strict subclass
72+
of child elements now confer their subclass upon the children (#5457).
73+
374
* `ggsave()` no longer sometimes creates new directories, which is now
475
controlled by the new `create.dir` argument (#5489).
576

R/aes.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ alternative_aes_extract_usage <- function(x) {
425425
} else if (is_call(x, "$")) {
426426
as.character(x[[3]])
427427
} else {
428-
cli::cli_abort("Don't know how to get alternative usage for {.var {x}}")
428+
cli::cli_abort("Don't know how to get alternative usage for {.var {x}}.")
429429
}
430430
}
431431

R/annotation-custom.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ GeomCustomAnn <- ggproto("GeomCustomAnn", Geom,
7171
draw_panel = function(data, panel_params, coord, grob, xmin, xmax,
7272
ymin, ymax) {
7373
if (!inherits(coord, "CoordCartesian")) {
74-
cli::cli_abort("{.fn annotation_custom} only works with {.fn coord_cartesian}")
74+
cli::cli_abort("{.fn annotation_custom} only works with {.fn coord_cartesian}.")
7575
}
7676
corners <- data_frame0(
7777
x = c(xmin, xmax),

R/annotation-logticks.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#' Annotation: log tick marks
22
#'
3+
#' @description
4+
#' `r lifecycle::badge("superseded")`
5+
#'
6+
#' This function is superseded by using [`guide_axis_logticks()`].
7+
#'
38
#' This annotation adds log tick marks with diminishing spacing.
49
#' These tick marks probably make sense only for base 10.
510
#'
@@ -61,8 +66,8 @@
6166
#' # plotting it. Also hide the minor grid lines.
6267
#' b <- ggplot(msleep, aes(log10(bodywt), log10(brainwt))) +
6368
#' geom_point(na.rm = TRUE) +
64-
#' scale_x_continuous(name = "body", labels = scales::math_format(10^.x)) +
65-
#' scale_y_continuous(name = "brain", labels = scales::math_format(10^.x)) +
69+
#' scale_x_continuous(name = "body", labels = scales::label_math(10^.x)) +
70+
#' scale_y_continuous(name = "brain", labels = scales::label_math(10^.x)) +
6671
#' theme_bw() + theme(panel.grid.minor = element_blank())
6772
#'
6873
#' b + annotation_logticks()

R/annotation-map.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ annotation_map <- function(map, ...) {
6363
if (!is.null(map$long)) map$x <- map$long
6464
if (!is.null(map$region)) map$id <- map$region
6565
if (!all(c("x", "y", "id") %in% names(map))) {
66-
cli::cli_abort("{.arg map} must have the columns {.col x}, {.col y}, and {.col id}")
66+
cli::cli_abort("{.arg map} must have the columns {.col x}, {.col y}, and {.col id}.")
6767
}
6868

6969
layer(

R/annotation-raster.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ GeomRasterAnn <- ggproto("GeomRasterAnn", Geom,
7474
draw_panel = function(data, panel_params, coord, raster, xmin, xmax,
7575
ymin, ymax, interpolate = FALSE) {
7676
if (!inherits(coord, "CoordCartesian")) {
77-
cli::cli_abort("{.fn annotation_raster} only works with {.fn coord_cartesian}")
77+
cli::cli_abort("{.fn annotation_raster} only works with {.fn coord_cartesian}.")
7878
}
7979
corners <- data_frame0(
8080
x = c(xmin, xmax),

R/annotation.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#'
1414
#' @section Unsupported geoms:
1515
#' Due to their special nature, reference line geoms [geom_abline()],
16-
#' [geom_hline()], and [geom_vline()] can't be used with [annotate()].
16+
#' [geom_hline()], and [geom_vline()] can't be used with `annotate()`.
1717
#' You can use these geoms directly for annotations.
1818
#' @param geom name of geom to use for annotation
1919
#' @param x,y,xmin,ymin,xmax,ymax,xend,yend positioning aesthetics -

R/autolayer.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ autolayer <- function(object, ...) {
1515

1616
#' @export
1717
autolayer.default <- function(object, ...) {
18-
cli::cli_abort("No autolayer method available for {.cls {class(object)[1]}} objects")
18+
cli::cli_abort("No autolayer method available for {.cls {class(object)[1]}} objects.")
1919
}

0 commit comments

Comments
 (0)