r - Overlap in labels of point data in rasterVis -


i have raster r, 1 polygon shapefile regions , point shapefile cities. need plot 3 1 map layout. in addition need label point file names of cities (cities$city$town.name) , temperature , precipitation value (assigned cities$labels). have used following code packages '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 

this works fine when area has scattered cities distribution (see figure below). enter image description here however, if cities concentrated in 1 part experience overlap of labels (see figure below). there way avoid label overlap? enter image description here


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -