You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some algorithms, you need to set a plot to NULL.
For instance, if you are making plots in a loop, the current plot may have no sense for current parameters, in some limit-cases.
When adding ggplot layers with +, you can add NULL with no error, returning the original object. Would this be possible with patchwork also?
In my current task, I'm using patchwork to make a 2x2 plot table. For that, I have to make two 1x2 horizontal patches and then stack them using /. Either patch can be NULL.
I've been confronted with 2 cases:
the lower patch is NULL, yielding the error "Only knows how to fold ggplot objects together"
the upper patch is NULL, yielding the error "non-numeric argument to binary operator"
I'm not sure it is even doable (especially for the upper patch), but I'd think extending patchwork operators to allow for NULL would make sense, and it would also allow more flexibility in making algorithms.
Here is a reproducible example (simpler than my task):
patch/p2#> Error: Only knows how to fold ggplot objects togetherp2/p1#> Error in e1 + e2 + plot_layout(ncol = 1): non-numeric argument to binary operator
Hi Thomas,
In some algorithms, you need to set a plot to
NULL
.For instance, if you are making plots in a loop, the current plot may have no sense for current parameters, in some limit-cases.
When adding
ggplot
layers with+
, you can addNULL
with no error, returning the original object. Would this be possible withpatchwork
also?In my current task, I'm using patchwork to make a 2x2 plot table. For that, I have to make two 1x2 horizontal patches and then stack them using
/
. Either patch can beNULL
.I've been confronted with 2 cases:
NULL
, yielding the error "Only knows how to fold ggplot objects together"NULL
, yielding the error "non-numeric argument to binary operator"I'm not sure it is even doable (especially for the upper patch), but I'd think extending
patchwork
operators to allow for NULL would make sense, and it would also allow more flexibility in making algorithms.Here is a reproducible example (simpler than my task):
Created on 2022-01-31 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: