Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plot_layout axis_titles = "collect" has unusual behaviour for non-square assemblies #375

Closed
jack-davison opened this issue Aug 8, 2024 · 1 comment · Fixed by #378
Closed
Labels
bug an unexpected problem or unintended behavior

Comments

@jack-davison
Copy link

See examples below - when you have a perfect 3x3 grid you get a single ylab on the LHS, but when you have a missing panel you end up with two - one ylab centred on the top 2x3 area and then another for the bottom row, which does look a bit odd!

Is this expected behaviour for this option?

Cheers!

library(patchwork)

# I know this is deprecated, but it's the quickest way to get a ggplot2...
theplot <- ggplot2::qplot(iris$Sepal.Length) + ggplot2::labs(y = "Axis")
#> Warning: `qplot()` was deprecated in ggplot2 3.4.0.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

# this is okay
wrap_plots(rep(list(theplot), 9), nrow = 3) +
  plot_layout(axes = "collect")

# this looks a bit weird
wrap_plots(rep(list(theplot), 8), nrow = 3) +
  plot_layout(axes = "collect", axis_titles = "collect")

Created on 2024-08-08 with reprex v2.1.1

@jack-davison
Copy link
Author

On reflection, I can guess why this is happening - the x-axis is "split" so you have that gap for the smaller x-axis to be drawn, which I guess is causing the y-labs to be drawn separately.

@thomasp85 thomasp85 added the bug an unexpected problem or unintended behavior label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants