Last active
March 21, 2018 19:01
-
-
Save Pakillo/78c25233d72a87c69961a765393d91ff to your computer and use it in GitHub Desktop.
another reproducible map with Rstats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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