YuLab-SMU / aplot

Decorate a plot with associated information
https://yulab-smu.top/aplot
97 stars 14 forks source link

How to control the spacing between each plot #30

Closed wqssf102 closed 1 year ago

wqssf102 commented 1 year ago

Hi, How to control the spacing between each plot?

GuangchuangYu commented 1 year ago

It does nothing in the spacing. Each plot can adjust the spacing by using theme() if it is a ggplot.

GuangchuangYu commented 1 year ago

Another solution is to use ggplotify::as.ggplot(scale = a-number-less-than-1) for each plot and it works for almost all the plots including those produced in the base plot.

wqssf102 commented 1 year ago

options(space.between.plots=XXX), perfect.

aldendirks commented 7 months ago

I am attempting to decrease the horizontal space between some subplots to 0 but cannot figure out how to do so. The options function only works on the spacing of the last plot added, and even then it can increase the spacing but it cannot decrease it to 0. I have made sure to set all the margins of my supbplots to 0.

# options only works on the space to the right of the last plot 
composite_fig <- plot1 %>% 
  insert_left(plot2) %>%
  insert_left(plot3 width = 0.5) %>%
  insert_left(plot4 width = 0.5)
options(space.between.plots=10)
composite_fig