Skip to content

Commit f3114fc

Browse files
committed
resolve merge conflict
Merge branch 'main' into S7_objects # Conflicts: # R/guides-.R
2 parents e391d16 + f7da3b4 commit f3114fc

17 files changed

+171
-34
lines changed

R/coord-cartesian-.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,14 @@ coord_cartesian <- function(xlim = NULL, ylim = NULL, expand = TRUE,
9797
#' @export
9898
CoordCartesian <- ggproto("CoordCartesian", Coord,
9999

100-
is_linear = function() TRUE,
101-
is_free = function(self) is.null(self$ratio),
100+
is_linear = function() {
101+
TRUE
102+
},
103+
104+
is_free = function(self) {
105+
is.null(self$ratio)
106+
},
107+
102108
aspect = function(self, ranges) {
103109
if (is.null(self$ratio)) {
104110
return(NULL)

R/coord-fixed.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ coord_equal <- coord_fixed
3737
#' @usage NULL
3838
#' @export
3939
CoordFixed <- ggproto("CoordFixed", CoordCartesian,
40-
is_free = function() FALSE,
40+
is_free = function() {
41+
FALSE
42+
},
4143

4244
aspect = function(self, ranges) {
4345
diff(ranges$y.range) / diff(ranges$x.range) * self$ratio

R/coord-polar.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ coord_polar <- function(theta = "x", start = 0, direction = 1, clip = "on") {
2020
#' @export
2121
CoordPolar <- ggproto("CoordPolar", Coord,
2222

23-
aspect = function(details) 1,
23+
aspect = function(details) {
24+
1
25+
},
2426

25-
is_free = function() TRUE,
27+
is_free = function() {
28+
TRUE
29+
},
2630

2731
distance = function(self, x, y, details, boost = 0.75) {
2832
arc <- self$start + c(0, 2 * pi)

R/coord-radial.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ CoordRadial <- ggproto("CoordRadial", Coord,
199199
diff(details$bbox$y) / diff(details$bbox$x)
200200
},
201201

202-
is_free = function() TRUE,
202+
is_free = function() {
203+
TRUE
204+
},
203205

204206
distance = function(self, x, y, details, boost = 0.75) {
205207
arc <- details$arc %||% c(0, 2 * pi)

R/coord-sf.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,15 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
303303
},
304304

305305
# CoordSf enforces a fixed aspect ratio -> axes cannot be changed freely under faceting
306-
is_free = function() FALSE,
306+
is_free = function() {
307+
FALSE
308+
},
307309

308310
# for regular geoms (such as geom_path, geom_polygon, etc.), CoordSf is non-linear
309311
# if the default_crs option is being used, i.e., not set to NULL
310-
is_linear = function(self) is.null(self$get_default_crs()),
312+
is_linear = function(self) {
313+
is.null(self$get_default_crs())
314+
},
311315

312316
distance = function(self, x, y, panel_params) {
313317
d <- self$backtransform_range(panel_params)
@@ -328,7 +332,9 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
328332
diff(panel_params$y_range) / diff(panel_params$x_range) / ratio
329333
},
330334

331-
labels = function(labels, panel_params) labels,
335+
labels = function(labels, panel_params) {
336+
labels
337+
},
332338

333339
render_bg = function(self, panel_params, theme) {
334340
el <- calc_element("panel.grid.major", theme)

R/coord-transform.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ coord_trans <- function(...) {
126126
#' @export
127127
CoordTransform <- ggproto(
128128
"CoordTransform", Coord,
129-
is_free = function() TRUE,
129+
130+
is_free = function() {
131+
TRUE
132+
},
133+
130134
distance = function(self, x, y, panel_params) {
131135
max_dist <- dist_euclidean(panel_params$x.range, panel_params$y.range)
132136
dist_euclidean(self$trans$x$transform(x), self$trans$y$transform(y)) / max_dist

R/geom-blank.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ geom_blank <- function(mapping = NULL, data = NULL,
3535
#' @export
3636
GeomBlank <- ggproto("GeomBlank", Geom,
3737
default_aes = aes(),
38-
handle_na = function(data, params) data,
38+
handle_na = function(data, params) {
39+
data
40+
},
3941
check_constant_aes = FALSE,
40-
draw_panel = function(...) nullGrob()
42+
draw_panel = function(...) {
43+
nullGrob()
44+
}
4145
)

R/guide-colorbar.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@ GuideColourbar <- ggproto(
291291
# We set the defaults in `theme` so that the `params$theme` can still
292292
# overrule defaults given here
293293
if (params$direction == "horizontal") {
294-
theme$legend.key.width <- rel(5)
294+
theme$legend.key.width <- (theme$legend.key.width %||% rel(1)) * 5
295295
valid_position <- c("bottom", "top")
296296
} else {
297-
theme$legend.key.height <- rel(5)
297+
theme$legend.key.height <- (theme$legend.key.height %||% rel(1)) * 5
298298
valid_position <- c("right", "left")
299299
}
300300

R/labels.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,17 @@ setup_plot_labels <- function(plot, layers, data) {
8181
extra_labels <- setdiff(names(plot_labels), known_labels)
8282

8383
if (length(extra_labels) > 0) {
84-
extra_labels <- paste0(
85-
"{.code ", extra_labels, " = \"", plot_labels[extra_labels], "\"}"
84+
85+
warn_labels <- plot_labels[extra_labels]
86+
warn_labels <- ifelse(
87+
vapply(warn_labels, is.function, logical(1)),
88+
"{.cls function}",
89+
paste0("{.val ", warn_labels, "}")
8690
)
91+
92+
extra_labels <- paste0("{.field ", extra_labels, "} : ", warn_labels)
8793
names(extra_labels) <- rep("*", length(extra_labels))
94+
8895
cli::cli_warn(c(
8996
"Ignoring unknown labels:",
9097
extra_labels

R/layer.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ layer <- function(geom = NULL, stat = NULL,
181181
geom <- set_draw_key(geom, key_glyph %||% params$key_glyph)
182182

183183
fr_call <- layer_class$constructor %||% frame_call(call_env) %||% current_call()
184+
attr(fr_call, "srcref") <- NULL
184185

185186
ggproto("LayerInstance", layer_class,
186187
constructor = fr_call,

0 commit comments

Comments
 (0)