Reputation: 465
I have a plot with rasterVis::levelplots above other rasterVis::levelplots.
There is too much whitespace between them. How do I trim the whitespace?
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 )
Note that this method does not work Remove white space between plots and table in grid.arrange
Upvotes: 0
Views: 985
Reputation: 465
Adjust these parameters
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
Upvotes: 1