Skip to content

Commit be50e2d

Browse files
author
Chris Merkord
committed
Fix swapping of nrow & ncol for vertical facetting
The swap code always results in nrow and ncol being equal or both being NULL. Using dummy variables prevents this.
1 parent 23a748f commit be50e2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

R/facet-wrap.r

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed",
8686

8787
if (identical(dir, "v")) {
8888
# swap
89-
nrow <- sanitise_dim(ncol)
90-
ncol <- sanitise_dim(nrow)
89+
nrow_swap <- ncol
90+
ncol_swap <- nrow
91+
nrow <- sanitise_dim(nrow_swap)
92+
ncol <- sanitise_dim(ncol_swap)
9193
} else {
9294
nrow <- sanitise_dim(nrow)
9395
ncol <- sanitise_dim(ncol)

0 commit comments

Comments
 (0)