Skip to content

Commit c15e38b

Browse files
committed
Fixing argument name nomenclature
1 parent 2a373a6 commit c15e38b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

R/position-dodge.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#' (default) or `"y"`.
1919
#' @param reverse If `TRUE`, will reverse the default stacking order.
2020
#' This is useful if you're rotating both the plot and legend.
21-
#' @param stack_overlap Specifies if and how to stack the dodged geoms. Possible
21+
#' @param stack.overlap Specifies if and how to stack the dodged geoms. Possible
2222
#' values are `"no"` (default), `"by_extent"` or `"by_center"`. This parameter
2323
#' implements the dodge and stack functionality together. Use `"by_extent"` for
2424
#' columns and `"by_center"` for errorbars.
@@ -91,13 +91,13 @@
9191
#' ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
9292
#' geom_bar(position = position_dodge2(preserve = "total"))
9393
position_dodge <- function(width = NULL, preserve = "total", orientation = "x",
94-
reverse = FALSE, stack_overlap = "no") {
94+
reverse = FALSE, stack.overlap = "no") {
9595
check_bool(reverse)
9696
ggproto(NULL, PositionDodge,
9797
width = width,
9898
preserve = arg_match0(preserve, c("total", "single")),
9999
orientation = arg_match0(orientation, c("x", "y")),
100-
stack_overlap = arg_match0(stack_overlap, c("no","by_extent","by_center")),
100+
stack.overlap = arg_match0(stack.overlap, c("no","by_extent","by_center")),
101101
reverse = reverse
102102
)
103103
}
@@ -109,7 +109,7 @@ position_dodge <- function(width = NULL, preserve = "total", orientation = "x",
109109
PositionDodge <- ggproto("PositionDodge", Position,
110110
width = NULL,
111111
preserve = "total",
112-
stack_overlap = "no",
112+
stack.overlap = "no",
113113
orientation = "x",
114114
reverse = NULL,
115115
default_aes = aes(order = NULL),
@@ -142,7 +142,7 @@ PositionDodge <- ggproto("PositionDodge", Position,
142142

143143
list(
144144
width = self$width,
145-
stack_overlap = self$stack_overlap,
145+
stack.overlap = self$stack.overlap,
146146
n = n,
147147
flipped_aes = flipped_aes,
148148
reverse = self$reverse %||% FALSE
@@ -179,7 +179,7 @@ PositionDodge <- ggproto("PositionDodge", Position,
179179
strategy = pos_dodge,
180180
n = params$n,
181181
check.width = FALSE,
182-
stack_overlap = params$stack_overlap,
182+
stack.overlap = params$stack.overlap,
183183
reverse = !params$reverse # for consistency with `position_dodge2()`
184184
)
185185
flip_data(collided, params$flipped_aes)
@@ -188,7 +188,7 @@ PositionDodge <- ggproto("PositionDodge", Position,
188188

189189
# Dodge overlapping interval.
190190
# Assumes that each set has the same horizontal position.
191-
pos_dodge <- function(df, width, n = NULL, stack_overlap = "no") {
191+
pos_dodge <- function(df, width, n = NULL, stack.overlap = "no") {
192192
if (is.null(n)) {
193193
n <- vec_unique_count(df$group)
194194
}
@@ -213,7 +213,7 @@ pos_dodge <- function(df, width, n = NULL, stack_overlap = "no") {
213213
df$xmin <- df$x - d_width / n / 2
214214
df$xmax <- df$x + d_width / n / 2
215215

216-
if (stack_overlap == "by_extent") {
216+
if (stack.overlap == "by_extent") {
217217
# The code chunk below is just to implement the following line without tidyverse functions, as ggplot2 can be imported without that
218218
# df %>% group_by(group) %>% mutate(ymaxx = cumsum(ymax)) %>% mutate(ymin = ymaxx-ymax, ymax = ymaxx)
219219

@@ -228,7 +228,7 @@ pos_dodge <- function(df, width, n = NULL, stack_overlap = "no") {
228228

229229
df$ymaxx = NULL # Remove the extra variable
230230

231-
} else if (stack_overlap == "by_center") {
231+
} else if (stack.overlap == "by_center") {
232232
# Similarly to above, the complicated code below is just to do the next line without tidyverse
233233
# df %>% group_by(group) %>% mutate(extent = ymax-ymin, ymaxx = cumsum((ymax+ymin)/2)) %>% mutate(ymin = ymaxx-extent/2, ymax = ymaxx+extent/2)
234234

man/position_dodge.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)