2

Please pardon me if this is a redundant question. I am new to R. I was going through this post- http://www.r-bloggers.com/mapping-gps-tracks-in-r/. It maps the gps tracks in R using ggmap. My question is that, once we have the final map, is it possible to put grids on it? If yes, how to do it?

EDIT- Ok let me rephrase my question... suppose I have plotted some gps coordinate on a map. Then how to put grid over it? Let me take the example of one of the question already solved here at stack overflow by Cory: Plotting GPS coordinates using ggmap Here`s the final map:- enter image description here

Now my question is how to get a grid structure on this map? TIA!

TIA!

Regards, Lesnar

Community
  • 1
  • 1
Lesnar
  • 501
  • 3
  • 16
  • On mobile, but did you get a chance to review the documentation? – Bluebird Mar 16 '16 at 04:26
  • You mean, the ggmap package document? – Lesnar Mar 16 '16 at 04:29
  • Possible duplicate of [R - put ggplot grid lines in foreground](http://stackoverflow.com/questions/19054092/r-put-ggplot-grid-lines-in-foreground) – Jonathan Carroll Mar 16 '16 at 04:31
  • That looks like it is what lesnar is looking for, however since its about maps, I presume that lesnar would like it to scale with the size of the map. – Bluebird Mar 16 '16 at 04:36
  • @BobtheBuilder yes, exactly! That`s what I am looking for. Can this be done for maps as well? – Lesnar Mar 16 '16 at 04:43
  • you should add (including your dataset) to your post what you have tried so far. – MLavoie Mar 16 '16 at 08:50
  • @MLavoie ok.. have done it now! – Lesnar Mar 16 '16 at 15:44
  • something like that (ggmap(mapImageData) + geom_point(aes(x = lon,y = lat),data = gps,colour = "red",size = 1,pch = 20)) + geom_vline(xintercept=seq(-4.020, -4.017, by=0.0001)) + geom_hline(yintercept=seq(53.2, 53.25, by=0.001)) – MLavoie Mar 16 '16 at 15:56
  • @MLavoie Got it! Thanks a lot! – Lesnar Mar 16 '16 at 16:12
  • @MLavoie Perhaps a variable that determines the scale of the grid based on a calculation of the image resolution? – Bluebird Mar 18 '16 at 23:27
  • @lesnar Do your maps have a "scale" built in? As-in, "Map of New York" and part of the qualitative data associated with it says "2:1 scale". If so, then you can create a quick equation to extrapolate the scale of your grid. – Bluebird Mar 18 '16 at 23:30
  • @BobtheBuilder There`s no "scale" built in my map. But I get it what you mean here. Thanks! – Lesnar Mar 19 '16 at 05:21

0 Answers0