-
Notifications
You must be signed in to change notification settings - Fork 166
Closed
Description
Hello,
It looks like the plot_layout(axes = "collect") does not work when one of the plots has a facet_wrap that has multiple rows.
Take the following example:
## In this example, the axes merge fails
library(tidyverse)
p6 <- mtcars %>% ggplot() + geom_point(aes(mpg, disp, color=cyl)) +
labs(y = "Axes to Merge",
x = "")
## setting the facet wrap to multiple rows
p7 <- ggplot(mtcars) + geom_point(aes(mpg, hp, color=cyl)) +
facet_wrap(~cyl, ncol = 2) +
labs(y = "Axes to Merge",
x = "")
p6 + p7 + plot_layout(guides='collect',
axes = "collect")
On the other hand, not having multiple rows in the p7 plot renders no issue.
## In this example, the axes merge is correct
library(tidyverse)
p6 <- mtcars %>% ggplot() + geom_point(aes(mpg, disp, color=cyl)) +
labs(y = "Axes to Merge",
x = "")
## not setting the facet_wrap to have multiple rows
p7 <- ggplot(mtcars) + geom_point(aes(mpg, hp, color=cyl)) +
facet_wrap(~cyl) +
labs(y = "Axes to Merge",
x = "")
p6 + p7 + plot_layout(guides='collect',
axes = "collect")
Metadata
Metadata
Assignees
Labels
No labels