Skip to content
Prev 7970 / 29559 Next

Adding labels to map with either spplot or maptools (or anything else suggested)

Misha, you were close. I managed to get somewhat closer with:

plot(gadm)
text(getSpPPolygonsLabptSlots(gadm), labels=regionnames, cex=0.4)

still, you need to provide regionnames in the order of the polygons in
gadm, whether you use plot or spplot, in order to have the right labels.
The command factor orders them alphabetically, unless told otherwise.
The as.character was not needed, as regionnames already was character.

spplot is not an easy path for the plot you want, as it tries to give
colors to polygons in order to communicate something. Of course, you
could make all colors white but then there's still the legend to get rid
of. Plotting text on particular locations can be done by passing an
sp.layout argument - see ?spplot.

Hope this helps,
Misha Spisok wrote: