Skip to content

Commit 15263f7

Browse files
authored
Add setup_params method to Geom (#3509)
1 parent 047b528 commit 15263f7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ggplot2 (development version)
22

3+
* `Geom` now gains a `setup_params()` method in line with the other ggproto
4+
classes (@thomasp85, #3509)
5+
36
* `element_text()` now issues a warning when vectorized arguments are provided, as in
47
`colour = c("red", "green", "blue")`. Such use is discouraged and not officially supported
58
(@clauswilke, #3492).

R/geom-.r

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ Geom <- ggproto("Geom",
104104
stop("Not implemented")
105105
},
106106

107+
setup_params = function(data, params) params,
108+
107109
setup_data = function(data, params) data,
108110

109111
# Combine data with defaults and set aesthetics from parameters

R/layer.r

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ Layer <- ggproto("Layer", NULL,
340340
c(names(data), names(self$aes_params)),
341341
snake_class(self$geom)
342342
)
343-
344-
self$geom$setup_data(data, c(self$geom_params, self$aes_params))
343+
self$geom_params <- self$geom$setup_params(data, c(self$geom_params, self$aes_params))
344+
self$geom$setup_data(data, self$geom_params)
345345
},
346346

347347
compute_position = function(self, data, layout) {

0 commit comments

Comments
 (0)