An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100201/d747ea78/attachment.pl>
How to put name in map?
2 messages · Everton Emanuel, Roger Bivand
On Mon, 1 Feb 2010, Everton Emanuel wrote:
Dear all, I have a small problem concerning labelling regions and areas in R. I want to label a single polygon in a map. I succeed labelling to whole map, but when I try a single polygon it did not work. This is the command that I used: #for the whole area it works# plot(map) centroids<-coordinates(map) text(centroids,label=map$NAME) #for a single polygon in whole map, it does not work# plot(map) centroids<-coordinates(map)[10,1:2] text(centroids,label=map$NAME)
Maybe: centroids <- coordinates(map)[10, 1:2, drop=FALSE] text(centroids, label=map$NAME[10]) Roger
I appreciate any help. Thank you all.
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no