[R-sig-Geo] how to label points on a google map?
Chris Lusk
clusk at waikato.ac.nz
Sun Jul 3 08:56:43 CEST 2016
Hi - I'd appreciate any suggestions as to how I can superimpose numbers
over the coloured symbols I've plotted on a google map using the code
below. The numbers I want to use as labels are in the 1st column of the
table. I've seen a couple of solutions online, but neither has worked for
me.
..........
library(ggplot2)
library(ggmap)
Rangitikei <- read.table(text="number lon lat
11 175.74 -39.55
10 175.72 -39.65
9 175.97 -39.7
8 175.78 -39.81
7 175.67 -39.84
6 175.894 -39.84
5 175.96 -39.85
4 175.60 -39.90
3 175.37 -39.905
2 175.53 -39.96
1 175.60 -39.99", header = TRUE, strip.white = TRUE)
# Get the map
RangitikeiMap <- get_googlemap(center = c(lon = 175.736, lat = -39.8),
maptype='roadmap', zoom=10)
# Plot the points on the map
ggmap(RangitikeiMap) +
geom_point(data=Rangitikei, aes(x=lon, y=lat), colour="gold2", size=6,
alpha=.7)
.........
Dr. Chris Lusk
Senior Research Fellow
Environmental Research Institute
The University of Waikato
Private Bag 3105, Hamilton
New Zealand / Aotearoa
http://sci.waikato.ac.nz/sites/clusk/
Ph 64 7 838 4205
Senior Editor, *NZ J Botany*
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list