Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.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
rasterVis中点数据标签的重叠_R_R Raster_Levelplot_Rastervis - Fatal编程技术网

rasterVis中点数据标签的重叠

rasterVis中点数据标签的重叠,r,r-raster,levelplot,rastervis,R,R Raster,Levelplot,Rastervis,我有一个光栅r,一个多边形形状文件区域和一个点形状文件城市。我需要把这三个都画成一张地图。除此之外,我还需要为点文件添加城市名称(cities$city$Town.Name)及其温度和降水量值(指定为cities$labels)。因此,我在“raster”和“rasterVis”软件包中使用了以下代码 p1<-levelplot(regions.r,par.settings=mytheme,scales=list(draw=FALSE),xlab="",ylab="",margin=F)+

我有一个光栅
r
,一个多边形形状文件
区域
和一个点形状文件
城市
。我需要把这三个都画成一张地图。除此之外,我还需要为点文件添加城市名称(
cities$city$Town.Name
)及其温度和降水量值(指定为
cities$labels
)。因此,我在“raster”和“rasterVis”软件包中使用了以下代码

p1<-levelplot(regions.r,par.settings=mytheme,scales=list(draw=FALSE),xlab="",ylab="",margin=F)+
  layer(sp.polygons(regions))+
          layer(sp.points(cities,pch=20,cex=1.5,col="black"))
p1+
  layer(sp.text(coordinates(cities), txt = cities$city$Town.Name, pos = 3,col="black",font=list(face="bold"),cex=0.8))+
  layer(sp.text(coordinates(cities),txt = cities$label,
                pos = 1,cex=0.6,col="black"))#Add shapefile labels

p1您是否尝试过
maptools::sp.pointLabel
功能?谢谢,奥斯卡!这对我来说非常有效。