Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Patchwork does not collect guides

Patchwork does not collect guides with code in documentation… the reprex code is following:

Does anyone know what is causing the issue here, please?

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.0.5
library(patchwork)
p1a <- ggplot(mtcars) + 
  geom_point(aes(mpg, disp, colour = mpg, size = wt)) + 
  ggtitle('Plot 1a')

p2 <- ggplot(mtcars) + 
  geom_boxplot(aes(gear, disp, group = gear)) + 
  ggtitle('Plot 2')

p3 <- ggplot(mtcars) + 
  geom_point(aes(hp, wt, colour = mpg)) + 
  ggtitle('Plot 3')
p1a | (p2 / p3) + plot_layout(guides = 'collect')

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Created on 2022-11-26 by the reprex package (v2.0.1)

Session info – patchwork is updated

>Solution :

(p1a | (p2 / p3)) + plot_layout(guides = 'collect') 

enter image description here

Without the parentheses, the plot_layout() will only relate to the immediately preceding term, (p2 / p3). From the documentation for plot_layout():

If you are nesting grids, the layout is scoped to the current nesting
level.

I think in this case "the current nesting level" will be the most recent term.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading