Mapping Stations using ggmap

Create dummy data.

sites <- data.frame(SITE = c("A01", "A02", "B01", "B02", "C01", "C02"), GROUP = c("A", 
    "A", "B", "B", "C", "C"), LON = c(-80.7827, -80.63361111, -80.6914, -80.6693392173995, 
    -80.47194444, -80.46722222), LAT = c(25.9563, 26.14666667, 26.0821, 25.973946572104, 
    26.15888889, 26.08416667))

Set up basemap.

library(ggmap)

map <- get_map(location=c(lon=mean(range(sites$LON)), lat=mean(range(sites$LAT))),
               zoom=10, maptype="satellite")
# ggmap(map, extent="device")

Show all sites colored by group.

ggmap(map, darken=c(0.05, "white"), extent="device") + 
  geom_point(aes(x=LON, y=LAT, color=GROUP), data=sites, size=4) +
  geom_text(aes(x=LON, y=LAT, label=SITE), data=sites, hjust=-0.5)

plot of chunk unnamed-chunk-3

Highlight a single site.

site <- "C01"
ggmap(map, darken=c(0.05, "white"), extent="device") + 
  geom_point(aes(x=LON, y=LAT, color=(SITE==site)), data=sites, size=4) +
  geom_text(aes(x=LON, y=LAT, label=SITE), data=subset(sites, SITE==site), hjust=-0.5) +
  scale_color_manual(values=c("black", "red"), guide=FALSE)

plot of chunk unnamed-chunk-4