【发布时间】:2021-01-20 10:31:48
【问题描述】:
我的问题是,我在 6 个散点图中有一个具有 3 个不同标题的 gridarrange 对象。第二个标题有索引号,这使我的情节略小。有没有办法防止这种情况发生?
我的代码是:
a<- ggplot(data=Bad_Lauchstaedt, mapping=aes(x= `one_h_gap_ET0`, y= `BL 2-1`))+
geom_smooth(method = "lm",se=FALSE, color="red")+
geom_point(color="darkblue", shape=1)+
geom_abline(intercept = 0, slope = 1, color="black", size=1.2, linetype="twodash")+
labs(y="measured data", x="gap filled data by lysimeters", title = expression("ET"[0]))+
theme_bw()+
theme(plot.title = element_text(hjust = 0.5, size = 20))+
theme(axis.title.x = element_blank(),axis.text.x = element_blank(),axis.ticks.x = element_blank())+
theme(axis.title.y = element_blank(),axis.text.y = element_blank(), axis.ticks.y = element_blank())+
xlim(0,0.9)+
ylim(0,0.9)+
theme(plot.margin = unit(c(0,0,0,0),"pt"))+
geom_richtext(
data = b_label,
aes(posx, posy, label = label),
hjust = 0, vjust = 0,
size = 6,
fill = "white", label.color = "black")
scatterplots<- list(a,b,c,d,e,f)
grobs= lapply(scatterplots, ggplotGrob)
grid.arrange(arrangeGrob(grobs=scatterplots, widths= c(1,1,1),
layout_matrix = rbind(c(1,2,3),
c(4,5,6))),
left=grid::textGrob('hourly ET observed [mm]', gp=grid::gpar(fontsize=18), rot= 90),
bottom=grid::textGrob('hourly ET gap filled [mm]', gp=grid::gpar(fontsize=18)),
top = grid::textGrob('gap filled by', gp=grid::gpar(fontsize=24)))
【问题讨论】: