-
Notifications
You must be signed in to change notification settings - Fork 163
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
Shared titles and axes #337
Conversation
|
Thanks for your thoughts Thomas!
Is there a need to discriminate the x- or y-direction and if so, how would you like this to be exposed? We could add |
If we should discriminate I think the last suggestion is the best since we already have committed to string values |
Latest updates:
I think this PR is now in a good place for review. library(ggplot2)
devtools::load_all("~/packages/patchwork/")
#> ℹ Loading patchwork
theme_set(theme_grey())
p1 <- ggplot(mtcars) +
aes(x = cyl, y = disp) +
geom_point()
p2 <- p1 +
theme(axis.text = element_text(colour = "red")) +
labs(x = "foo", y = "bar")
p1 <- p1 + scale_y_continuous(labels = \(x) paste0("a long label indicating ", x))
p1 + p1 + p1 + p2 + plot_layout(2, 2, axes = "collect", axis_titles = "collect") Created on 2023-11-02 with reprex v2.0.2 |
Thank you! |
Amazing! |
Hi, It seems like this doesn't do anything when we use
|
Yes and no. The merging mechanism don't work over multiple nesting levels, which is what you've induced with your layout code. We had accepted this limitation, so while we agree that it doesn't work out ideally in your case, it generally does what we had intended. The solution to the problem would be to use an unnested layout design. |
Fair enough. Is there a way to raise a warning in this situation? Or alternatively mention it on the documentation? I could make a pull request (although the former seems to be complicated) |
This PR aims to fix #150.
Briefly, it adds options to
plot_layout()
that allows the user to:What can and cannot be merged is mostly determined by a homebrew 2D run-length encoding of a simplified layout.
An example using identical plots to showcase the sharing.
Notice the following:
Another example showing not-merge behaviour for the last plot.
Notice the following:
Created on 2023-10-23 with reprex v2.0.2
Why is this PR still WIP?
I have no idea (yet) how this interacts with facetting.Facetted plots don't share titles or axes.