Skip to content

Commit e4b1bda

Browse files
thomasp85hadley
authored andcommitted
Coord flip free x (#1857)
* Resolve data upon extraction within ggplot_build * Reassign scales if coord_flip
1 parent 36e08b6 commit e4b1bda

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

R/facet-wrap.r

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ FacetWrap <- ggproto("FacetWrap", Facet,
193193
if ((!inherits(coord, "CoordCartesian")) && (params$free$x || params$free$y)) {
194194
stop("ggplot2 does not currently support free scales with a non-cartesian coord", call. = FALSE)
195195
}
196+
if (inherits(coord, "CoordFlip")) {
197+
if (params$free$x) {
198+
layout$SCALE_X <- seq_len(nrow(layout))
199+
} else {
200+
layout$SCALE_X <- 1L
201+
}
202+
if (params$free$y) {
203+
layout$SCALE_Y <- seq_len(nrow(layout))
204+
} else {
205+
layout$SCALE_Y <- 1L
206+
}
207+
}
196208

197209
ncol <- max(layout$COL)
198210
nrow <- max(layout$ROW)

0 commit comments

Comments
 (0)