Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用levelplot在rasterVis中绘制分类数据时更改背景颜色_R_Background Color_Levelplot_Rastervis - Fatal编程技术网

使用levelplot在rasterVis中绘制分类数据时更改背景颜色

使用levelplot在rasterVis中绘制分类数据时更改背景颜色,r,background-color,levelplot,rastervis,R,Background Color,Levelplot,Rastervis,我有一个分类数据(lulc),用于有6个等级的土地利用土地覆盖。我正在尝试使用rasterVis中的levelplot绘制此数据 l<-as.factor(lulc) rat <- levels(l)[[1]] rat[["landcover"]] <- c("Agriculture", "Bare land", "Built-up", "Vegetation","Water","Wetland") levels(lulc) <- rat levelplot(lulc,

我有一个分类数据
(lulc)
,用于有6个等级的土地利用土地覆盖。我正在尝试使用
rasterVis
中的
levelplot
绘制此数据

l<-as.factor(lulc)
rat <- levels(l)[[1]]
rat[["landcover"]] <- c("Agriculture", "Bare land", "Built-up", "Vegetation","Water","Wetland")
levels(lulc) <- rat
levelplot(lulc, col.regions=c("yellow","cyan","pink","green","lightblue","orange"), xlab="", ylab="")
l试试看

库(rasterVis)

f请习惯于提供最少的可复制示例。有时,通过这样做(例如,通过查看
?rasterVis::levelplot
)上的示例,问题会自动得到答案。谢谢@lukeA,它成功了<代码>层级图(R,Par,Stase=列表(COLL=“SkyBrey”)),COLL区域=C(“黄色”,“青色”,“粉色”,“绿色”,“淡蓝色”,“橙色”)< /代码>可以使用<代码> VistIDIS < /代码>包使用 LealPrime(R,PARSETABLE=LIST(Panel.Base=列表(COL= = Grey27))),Cel.Sale= ViIDIS::岩浆(n=1000)
library(rasterVis)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
levelplot(r, par.settings=list(panel.background=list(col="skyblue")))