2017-06-01 92 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