I am trying to plot a box with points over a map, but in the Pacific region. I am having some problems, since the points that define the box are not connecting well. To better understand the idea, here is part of the code:
#Definig the box
dput(box)
newmap <- getMap()
m <-plot(newmap, col = "light yellow", axes = T,asp=1)
for (i in 1:length(box)) {
p_names[i] <- paste("p",i,sep="")
points(box[1,i],box[2,i], pch=16, col="grey20", cex=1)
text(box[1,i],box[2,i], labels=as.character(p_names[i]), col="grey20",
cex=0.6, font=2, offset=0.5, adj=c(0,2))
}
grid(c="black")
The plot would be something like this:
I'm using the library rworldmap, but maybe there is a better way, since I know that with map you can choose the center..but then, I don't know how to add the box.
Any suggestion would be very welcome.