patchwork icon indicating copy to clipboard operation
patchwork copied to clipboard

Small gap between plots when specifying plot heights

Open tjebo opened this issue 3 years ago • 0 comments

This Stackoverflow post pointed towards the following behaviour: When specifying plot heights, there is a small gap visible between the plots. This disappears when passing theme globally.

It seems also a device issue. It's not really an issue (especially not to me), just wanted to add it here in case it might point to other problems.

No line

library(patchwork)
library(ggplot2)
p <-
  replicate(2, list(
    plot_spacer() + 
      theme(plot.background = element_rect(fill = "grey20",color = "grey20"))))

wrap_plots(p, nrow = 2)

Line

wrap_plots(p, nrow = 2, heights = c(1,.1)) 

Line disappears

wrap_plots(p, nrow = 2, heights = c(1,.1)) &
  theme(plot.background = element_rect(fill = "grey20",color = "grey20"))

Created on 2021-04-04 by the reprex package (v1.0.0)

tjebo avatar Apr 04 '21 19:04 tjebo