patchwork icon indicating copy to clipboard operation
patchwork copied to clipboard

Error combining absolutely sized patchwork objects using `+` since `v1.3.0`

Open jbengler opened this issue 1 year ago • 0 comments

Hi @thomasp85

thanks a lot for the great package!

Since v1.3.0 it is no longer possible to combine absolutely sized patchwork objects using +

library(tidyverse)
library(patchwork)

p1 <-
  ggplot(mtcars, aes(mpg, cyl)) +
  geom_point() +
  plot_layout(widths = unit(50, "mm"), heights = unit(50, "mm"))

v1.3.0

p1 + p1

Error in `class<-`(unlist(lapply(x, as.unit), recursive = FALSE), c("unit",  : 
  attempt to set an attribute on NULL

v1.2.0

p1 + p1

Works!

Conclusion

Why would you want to do this in the first place?

Well, obviously this is just a toy example. In reality, I often craft many individual plots, and fix their absolute dimensions with patchwork. Then later I combine them into a multi-panel figure.

Since this is a new behavior, maybe it has a feasible fix. I would appreciate it!

jbengler avatar Jan 10 '25 17:01 jbengler