我有一个带有rasterVis :: levelplots的图,高于其他rasterVis :: levelplots。
它们之间的空白太多。如何修剪空白?
library(raster)
library(rasterVis)
library(gridExtra)
## Raster Setup
r <- raster::raster( matrix(runif(9),3,3) )
l <- rasterVis::levelplot( stack(r,r,r,r),
layout=c(2,2),
names=rep('',4),
scales=list(draw=FALSE),
between=list(x=0.2,y=-.8),
margin=FALSE, main=NA)
## Adjust Heights
l$par.settings$layout.heights[
c( 'bottom.padding',
'top.padding',
'key.sub.padding',
'axis.xlab.padding',
'key.axis.padding',
'main.key.padding'
) ] <- -10
## Plot Grobs
grobs <- arrangeGrob(grobs=list(l,l,l,l), ncol=2)
grid.arrange(grobs )
请注意,此方法无效 Remove white space between plots and table in grid.arrange
答案 0 :(得分:0)
调整这些参数
l$par.settings$layout.heights[
c( 'bottom.padding',
'top.padding',
'key.sub.padding',
'axis.xlab.padding',
'key.axis.padding',
'main.key.padding') ] <- -1
l$aspect.fill <- TRUE