1

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:

enter image description here

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.

user3231352
  • 799
  • 1
  • 9
  • 26
  • 1
    So, you want to plot a pacific-centered world map, is that correct? – hrbrmstr Aug 17 '16 at 20:25
  • Pretty much..I want to plot over the maps the points that defining the box together..right now, the points are separated ..so I guess that moving the center of map would solve that problem, but I don't know using rworldmap. – user3231352 Aug 17 '16 at 20:32
  • http://stackoverflow.com/questions/5353184/fixing-maps-library-data-for-pacific-centred-0-360-longitude-display & http://stackoverflow.com/questions/10620862/use-different-center-than-the-prime-meridian-in-plotting-a-world-map/10749877#10749877 & http://stackoverflow.com/questions/11201997/world-map-with-ggmap – hrbrmstr Aug 18 '16 at 02:00

0 Answers0