Skip to content

Commit d8bd6d7

Browse files
committed
fallback for location based data
1 parent 6298aec commit d8bd6d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

R/position-dodge.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ PositionDodge <- ggproto("PositionDodge", Position,
117117
if (identical(self$preserve, "total")) {
118118
n <- NULL
119119
} else {
120-
n <- vec_unique(data[c("group", "PANEL", "xmin")])
121-
n <- vec_group_id(n[c("PANEL", "xmin")])
120+
data$xmin <- data$xmin %||% data$x
121+
cols <- intersect(colnames(data), c("group", "PANEL", "xmin"))
122+
n <- vec_unique(data[cols])
123+
n <- vec_group_id(n[setdiff(cols, "group")])
122124
n <- max(tabulate(n, attr(n, "n")))
123125
}
124126

0 commit comments

Comments
 (0)