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

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

Open
jbengler opened this issue Jan 10, 2025 · 0 comments
Open

Comments

@jbengler
Copy link

jbengler commented Jan 10, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant