标题名称在R中将图形推低

时间:2014-08-06 09:21:02

标签: r lattice

以下是示例:

rdata <- data.frame(y=rnorm(1000,2,2),v1=rnorm(1000,1,1),v2=rnorm(1000,3,3),
                v3=rnorm(1000,4,4),v4=rnorm(1000,5,5))


library(lattice)
library(gridExtra)    

title1 <- c("","","Title pushes graph down")
title2 <- c("","","Also here graph lower")

plot1 <- lapply(1:3, function(i) {bwplot(~rdata[,i],rdata,          
main=list(paste(title1[i],sep=""), fontsize=9, col="black"))})
plot2 <- lapply(1:3, function(i) {bwplot(~rdata[,i],rdata,    
main=list(paste(title2[i],sep=""), fontsize=9, col="black"))})


l <- lapply(list(plot1, plot2), 
           function(i) do.call(arrangeGrob, c(i, nrow=1, ncol=3)))

do.call(grid.arrange, l)

如何避免图表低于没有标题的图表?

1 个答案:

答案 0 :(得分:1)

尝试

title1 <- c(" "," ","Title pushes graph down")
title2 <- c(" "," ","Also here graph lower")

enter image description here