I'm trying to create a map with ggplot where sites are indicated using a point and a number on the map, and that numbering scheme is retained in the legend. So I'd like the first site to be labeled by a point with the number 1 in the center, and so on. Here's my code now:
library(tidyverse)
# download site data
dod <- read_csv('https://raw.githubusercontent.com/jaymwin/fcpp_GIS/master/data/DoD_sites_latlong.csv') %>%
filter(site != 'Fort Wainwright') %>%
mutate(
num = row_number() # my way of numbering the sites
)
dod
# download state outlines
states <- map_data('state')
# plot them
ggplot() +
geom_polygon(data = states, aes(long, lat, group = group), fill = 'grey95', color = 'darkgrey') +
geom_point(data = dod, aes(x = lon, y = lat, color = site), size = 4) +
geom_text(data = dod, aes(label = num, x = lon, y = lat),
size = 2, color = 'white', fontface = 'bold') +
scale_color_manual(values = c(rep('tomato', 12)), name = 'Site') +
labs(
x = 'Longitude',
y = 'Latitude'
) +
theme_minimal()
Is it possible to have the map numbering scheme to correspond to the legend numbering scheme?