-
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
[Feature Request] Determine number of patches #293
Comments
I tried length(composition_arranged$patches$layout$design) and it gave me the correct length. Had the same issue: |
Just banged my head against this as well, but @BioinformaNicks solutions doesn't seem to work for me, any other suggestions?: library(ggplot2)
library(patchwork)
p<-ggplot(mtcars,aes(mpg, disp)) +
geom_col()
p1 <- ggplot(mtcars,aes(disp, mpg)) +
geom_col()
p2<- p + p1
p2$patches$layout$design
# NULL |
Perhaps the difference is that I typically use the plot_layout function to arrange my plots, and not the simple p1+p2 syntax? |
Maybe that's true, which would make an even a better case for unified and straightforward to use solution.. |
Hello,
Awesome package this! I would like to know if there could be a way to determine the number of patches of the current plot and/or access information on the layout. This would allow, among other things, looping over these patches.
My attempt at accessing these attributes
This contains the required information but there is no way to extract the number 2 without resorting to a RegEx based
grep
length
on the other hand gives 10 which is not ideal.A solution
The above however will return only one plot if the plots are identical giving an incorrect length of 1.
Thank you very much and apologies if this is documented/or exists somewhere else already ( I could not find them).
NelsonGon
The text was updated successfully, but these errors were encountered: