2017-06-01 79 views

回答

0

您可以通過將colorkey=list(height=1)傳遞給levelplot函數來設置圖例高度。

library(raster) 
library(rasterVis) 

## Example data 
r <- raster(ncol=4, nrow=2) 
r[] <- sample(1:4, size=ncell(r), replace=TRUE) 
r <- as.factor(r) 

## Add a landcover column to the Raster Attribute Table 
rat <- levels(r)[[1]] 
rat[["landcover"]] <- c("land","ocean/lake", "rivers","water bodies") 
levels(r) <- rat 

## Plot 
levelplot(r, colorkey=list(height=1), col.regions=rev(terrain.colors(4)), xlab="", ylab="") 
+0

完美!非常感謝! – Ktelo