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.
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)