Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rgooglemaps plotting of text

Tags:

r

rgooglemaps

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.

like image 940
3502 Avatar asked Dec 09 '11 06:12

3502


1 Answers

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)
like image 149
mathematical.coffee Avatar answered Nov 03 '22 21:11

mathematical.coffee