I plotted a raster data using levelplot
> library(raster)
> ras > raster("DEM.tif")
> spplot(S_dub, colorkey = list(space ="right",height=1, width=1, hjust = .3),
col.regions = coul,scales=list(alternating=TRUE),
xlab = list(label = "Longitude", vjust = -.2),ylab = "Latitude")
The problem is that the colorbar is a bit far from the plot and I want to bring it closer to the plot. Actually, I noticed it happens only when I add the code scales=list(alternating=TRUE)
. I tried hjust
but it doesn't work.
How to reduce the gap/space between the plot and the colorbar?