Skip to content
Prev 6983 / 29559 Next

Map labels

On Mon, 23 Nov 2009, tom sgouros wrote:

            
Thanks for the verbatim code. I think that you need to name the argument 
sp.layout= rather than layout=. Because of the ... argument list, layout= 
doesn't get rejected, but it doesn't get used either. The gallery could do 
with refreshing, more recently you could say:

list("sp.text", coordinates(rep.map), row.names(rep.map))

to put the FID value (feature ID) at the centroid of the largest member 
polygon (Polygon object) of the entity (Polygons object), for each entity 
of the data set.

Use the other arguments to text() as usual to change size, etc.

If overlapping is a problem, use pointLabel() in maptools to provide 
alternative placings for the same set of labels and cex= value (with 
thanks to Tom Short).

Hope this helps,

Roger