Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formals of compute_layer() #3244

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Expand Up @@ -134,6 +134,9 @@ core developer team.
this can be used to have inwards ticks on the x-axis (`axis.ticks.length.x`) and
outwards ticks on the y-axis (`axis.ticks.length.y`) (@pank, #2935).

* The arguments of `Stat*$compute_layer()` and `Position*$compute_layer()` are
now renamed to always match the ones of `Stat$compute_layer()` and
`Position$compute_layer()` (@yutannihilation, #3202).

# ggplot2 3.1.0

Expand Down
2 changes: 1 addition & 1 deletion R/position-identity.r
Expand Up @@ -11,7 +11,7 @@ position_identity <- function() {
#' @usage NULL
#' @export
PositionIdentity <- ggproto("PositionIdentity", Position,
compute_layer = function(data, params, scales) {
compute_layer = function(self, data, params, layout) {
data
}
)
2 changes: 1 addition & 1 deletion R/position-jitter.r
Expand Up @@ -72,7 +72,7 @@ PositionJitter <- ggproto("PositionJitter", Position,
)
},

compute_layer = function(data, params, panel) {
compute_layer = function(self, data, params, layout) {
trans_x <- if (params$width > 0) function(x) jitter(x, amount = params$width)
trans_y <- if (params$height > 0) function(x) jitter(x, amount = params$height)

Expand Down
2 changes: 1 addition & 1 deletion R/position-nudge.R
Expand Up @@ -45,7 +45,7 @@ PositionNudge <- ggproto("PositionNudge", Position,
list(x = self$x, y = self$y)
},

compute_layer = function(data, params, panel) {
compute_layer = function(self, data, params, layout) {
# transform only the dimensions for which non-zero nudging is requested
if (any(params$x != 0)) {
if (any(params$y != 0)) {
Expand Down
4 changes: 2 additions & 2 deletions R/stat-bindot.r
Expand Up @@ -14,13 +14,13 @@ StatBindot <- ggproto("StatBindot", Stat,
params
},

compute_layer = function(self, data, params, panels) {
compute_layer = function(self, data, params, layout) {
data <- remove_missing(data, params$na.rm,
params$binaxis,
snake_class(self),
finite = TRUE
)
ggproto_parent(Stat, self)$compute_layer(data, params, panels)
ggproto_parent(Stat, self)$compute_layer(data, params, layout)
},

compute_panel = function(self, data, scales, na.rm = FALSE, binwidth = NULL,
Expand Down
2 changes: 1 addition & 1 deletion R/stat-identity.r
Expand Up @@ -33,7 +33,7 @@ stat_identity <- function(mapping = NULL, data = NULL,
#' @usage NULL
#' @export
StatIdentity <- ggproto("StatIdentity", Stat,
compute_layer = function(data, scales, params) {
compute_layer = function(self, data, params, layout) {
data
}
)