-
Notifications
You must be signed in to change notification settings - Fork 167
Open
Description
The axis_title = "collect" argument in plot_layout doesn't seem to work with facets. I'm not sure if this might be a bug, or if it was intended?
In example 1 below, plot 3 (p3, no facets) can have its axis titles collected.
In examples 2 (p3_facet_x) and 3 (p3_facet_y), the faceted side doesn't have its axis title collected.
data(mtcars)
# Create plots
p1 <- ggplot(mtcars) +
geom_point(aes(mpg, disp)) +
ggtitle('Plot 1') +
labs(x = 'X Label', y = 'Y Label')
p2 <- ggplot(mtcars) +
geom_point(aes(disp, hp)) +
ggtitle('Plot 2') +
labs(x = 'X Label', y = 'Y Label')
p3 <- ggplot(mtcars) +
geom_point(aes(drat, wt)) +
ggtitle('Plot 3a') +
labs(x = 'X Label', y = 'Y Label')
# facet plots
p3_facet_x <- ggplot(mtcars) +
geom_point(aes(drat, wt)) +
facet_grid(. ~ gear) +
ggtitle('Plot 3b') +
labs(x = 'X Label', y = 'Y Label')
p3_facet_y <- ggplot(mtcars) +
geom_point(aes(drat, wt)) +
facet_grid(gear ~ .) +
ggtitle('Plot 3c') +
labs(x = 'X Label', y = 'Y Label')
# Example 1: axis titles collect
p1 + p2 + p3 +
plot_layout(axis_titles = 'collect')
# Example 2: x-axis does not collect all the way
p1 + p2 + p3_facet_x +
plot_layout(axis_titles = 'collect')
# Example 3: y-axis does not collect all the way
p1 + p2 + p3_facet_y +
plot_layout(axis_titles = 'collect')
Metadata
Metadata
Assignees
Labels
No labels