5

I am using the Rgooglemaps package in R.

I want to display text over plotted point using PlotOnStaticMap. There is also function named TextOnStaticMap for plotting text on specified coordinates.

But in the output map either text is printed or points are plotted, but i need both.

rcs
  • 67,191
  • 22
  • 172
  • 153
3502
  • 103
  • 1
  • 5
  • Shameless plug: As an alternative to Rgooglemaps, you may want to check out DeducerSpatial, which was just released to CRAN http://blog.fellstat.com/?p=89 – Ian Fellows Dec 09 '11 at 18:15

1 Answers1

5

You need to feed in the add=TRUE option to the relevant function. If it's FALSE (the default) you get a new plot.

PlotOnStaticMap(MyMap,lat=..,lon=..,FUN=points)
TextOnStaticMap(MyMap,lat=..,lon=..,labels=.., add=TRUE) # <- adds to current map

Note, you can just use PlotOnStaticMap for all of this with different FUN (for example text,points,lines - the usual plotting functions):

PlotOnStaticMap(MyMap,lat=..,lon=..,FUN=points)
PlotOnStaticMap(MyMap,lat=..,lon=..,FUN=text, labels=.., add=TRUE)
mathematical.coffee
  • 55,977
  • 11
  • 154
  • 194