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
{{ message }}
Repository navigation
fails with ggh4x::facet_wrap2(trim_blank=FALSE) #442
When using ggh4x::facet_wrap2 in a subplot and combining, it works only if trim_blank=TRUE (the default); if I try to preserve blanks then it presents a blank canvas.
It might be that one of the assumptions of patchwork is to have a grob present (even if it is a zeroGrob()) at a panel position, whereas this is not the case with ggh4x::facet_wrap2(trim_blank = FALSE). It might be more appropriate for ggh4x to replace the empty panels with zeroGrob()s than to remove the panels.
I explored this problem a while ago but haven't found a satisfactory solution. Leaving in dummy grobs to satisfy the gtable assumptions would disrupt the current mechanism too much for me to commit to that.
For the record (future me + anybody else who may be interested, until something more "proper" may be implemented), an interim solution for me is to use ggplot2::facet_wrap() for the normal plot, and add another similar plot with the correct number of panes with theme_void() (completely empty). It's imperfect (the pane alignment is off a little in some of my plots though not below), but it's workable for now.
Activity
teunbrand commentedon Aug 11, 2025
It might be that one of the assumptions of patchwork is to have a grob present (even if it is a
zeroGrob()) at a panel position, whereas this is not the case withggh4x::facet_wrap2(trim_blank = FALSE). It might be more appropriate for ggh4x to replace the empty panels withzeroGrob()s than to remove the panels.r2evans commentedon Aug 11, 2025
I figured it'd be something special with the empty space.
r2evans commentedon Apr 8, 2026
Any traction here in patchwork or in ggh4x#202? @teunbrand
teunbrand commentedon Apr 8, 2026
I explored this problem a while ago but haven't found a satisfactory solution. Leaving in dummy grobs to satisfy the gtable assumptions would disrupt the current mechanism too much for me to commit to that.
r2evans commentedon Apr 9, 2026
For the record (future me + anybody else who may be interested, until something more "proper" may be implemented), an interim solution for me is to use
ggplot2::facet_wrap()for the normal plot, and add another similar plot with the correct number of panes withtheme_void()(completely empty). It's imperfect (the pane alignment is off a little in some of my plots though not below), but it's workable for now.