R Question

Adjust widths of multiple plots made by lapply, arrangeGrob

I have code to make plots following:
My question is how to adjust the widths of 1st plot and last plot in the figure made?

dat=data.frame(x=rep(c("M","D"),each=60),y=rep(rep(c(4,6,8,10,12),each=12),2),z=runif(120,0,100),s=rep(c(1:4),each=3,len=120))

gp=lapply(split(dat,dat$y),function(dfr){
g=ggplot(data = dfr, aes(s,z)) +
geom_point(aes(shape=x,colour=x),size=4)+
ylim(0,100)+
xlab("Int segs")+
ggtitle(paste(dfr[1,2],"hours"))
return(g)})
tiff(file="Pas.tiff",width=60, height = 22,units="cm",res=300)
require(gridExtra)
rg=arrangeGrob(grobs=list(gp$`4` + theme(legend.position="none"),
gp$`6` + theme(legend.position="none",
axis.title.y = element_blank(),
axis.text.y = element_blank()),
gp$`8` + theme(legend.position="none",
axis.title.y = element_blank(),
axis.text.y = element_blank()),
gp$`10` + theme(legend.position="none",
axis.title.y = element_blank(),
axis.text.y = element_blank()),
gp$`12` + theme(axis.title.y = element_blank(),
axis.text.y = element_blank())),ncol=5,
top=textGrob("Pas rate",
gp=gpar(fontsize=20,fontface="bold"),
y = unit(.4, "cm")),
theme(margin(t=70,r=0.2,b=0.5,l=0.3,unit="mm")))

grid.newpage()
#grid.draw(cbind(lg, rg, size = "last"))
grid.draw(rg)
dev.off()

Answer

i'd use cbind() here (if facetting isn't an option)

gp[[1]] <- gp[[1]] + theme(legend.position="none")
gp[[5]] <- gp[[5]] + theme(axis.title.y = element_blank(),
                             axis.text.y = element_blank())
gp[c("6", "8", "10")] <- lapply(gp[c("6", "8", "10")], "+", e2 = theme(legend.position="none",
                                                                       axis.title.y = element_blank(),
                                                                       axis.text.y = element_blank()))

grid.newpage()
grid.draw(do.call(gridExtra::cbind.gtable, lapply(gp, ggplotGrob)))

enter image description here