Skip to content

Instantly share code, notes, and snippets.

@Pakillo Pakillo/repromap.R
Last active Mar 21, 2018

Embed
What would you like to do?
another reproducible map with Rstats
library(sf)
library(ggspatial)
library(ggthemes)
coast <- rnaturalearth::ne_coastline(scale = "small", returnclass = "sp")
forests <- st_read("data/forestmap/cfc_gen.shp")
forest.redux <- rmapshaper::ms_simplify(forests)
forest.redux.sp <- as(forest.redux, "Spatial")
# could also use geom_sf from ggplot2 on github
ggplot() + coord_map() +
geom_spatial(forest.redux.sp, show.legend = FALSE,
col = "gray 80", fill = "gray 80") +
geom_spatial(coast, col = "gray 40") +
theme_map() +
xlim(-170, 180) +
ylim(-55, 80) +
geom_point(data = coords, aes(x = lon, y = lat, fill = vegtype),
colour = "black", size = 5, shape = 21) +
theme(legend.title = element_blank(), legend.text = element_text(size = 12),
legend.position = c(0.05, 0.15))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.