patchwork
patchwork copied to clipboard
`free()` in nested patchwork breaks `/`, `|`, and `-` operators
Using free() in a nested patchwork and trying to add a plot below with / throws an error. This also applies to the | and - operators regardless of whether the nesting is implicit or explicit.
Here are examples that throw the error:
p <- iris %>%
ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point()
(p + free(p)) / p
>> Error in split.default(names(settings), settings): first argument must be a vector
p / (p + free(p))
>> Error in split.default(names(settings), settings): first argument must be a vector
p + p / free(p)
>> Error in split.default(names(settings), settings): first argument must be a vector
p + free(p) | p
>> Error in split.default(names(settings), settings): first argument must be a vector
p + free(p) - p
>> Error in split.default(names(settings), settings): first argument must be a vector
Interestingly, it's fine if the free is not the final plot in the nested patchwork:
(free(p) + p) / p
Also, using design works:
(p + free(p)) + p + plot_layout(design = "AB\nCC")
Without nesting is also fine:
free(p) / p
I have the same problem, throws the same error when nested.
I have the same problem, throws the same error when nested.