Skip to content

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

Open
@jbengler

Description

@jbengler

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions