R: grouping of coordinates on a world map

I would like to build a set of coordinates organized in studies / groups on the world map indicated in the legend. The data set is organized as follows: AUTHORS | LAT | LONG The multiple coordinates corresponding to one study do not differ from each other. Is it possible to depict numbers instead of symbols and associate them with a legend?

library(maps) library(mapdata) test<-data.frame(Authors=(letters[1:9]), LAT=(seq(10,90,by=10)), LONG=(seq(10,90,by=10))) map('worldHires') points(test$LONG,test$LAT, col="red") 

I do not know how to extract information from the authors vector and link it with lat / long data as part of the legend. Does it even work with points ?

0
source share
1 answer
 library(maps) library(mapdata) test<-data.frame(Authors=(letters[1:9]), LAT=runif(9,-90,90), LONG=runif(9,-180,180)) map('worldHires') text(test$LONG,test$LAT,labels=1:9, col="red", font=2) legend("bottom",legend=test$Authors, col="red", pch=as.character(1:9), bg="white", ncol=3) 

Use text instead of points (you can use points , but you will need to choose pch=as.character(1:9) ). Here I added the argument font=2 so that they are highlighted in bold, which makes them more legible.
Then the creation of the legend is quite straightforward.

enter image description here

+1
source

Source: https://habr.com/ru/post/1263426/


All Articles