https://github.com/lydiaPenglish/smoothMap
knitr::opts_chunk$set(warning = F, message = F, fig.align = "center")
The goal of smoothMap
is to generate a function to help map files.
You can install the released version of smoothMap
from Github with:
devtools::install_github("lydiaPenglish/smoothMap")
This is a basic example which shows you how to use the functions in smoothMap
:
library(smoothMap) library(ggplot2) isl_file <- system.file("extdata", "gadm36_ISL_1.shp", package = "smoothMap") isl_data <- team_1(isl_file, tolerance = 0.01) ggplot(isl_data, aes(x = long, y = lat, group = group)) + geom_polygon(color = "black", fill = "white", size = 0.2) + labs(x = "Longitude", y = "Latitude", title = "Iceland") + coord_quickmap() + theme_bw() + theme(plot.title = element_text(hjust = 0.5)) cub_file <- system.file("extdata", "gadm36_CUB_1.shp", package = "smoothMap") cub_data <- team_2(cub_file, tolerance = 0.01) ggplot(cub_data, aes(x = long, y = lat, group = group)) + geom_polygon(color = "black", fill = "white", size = 0.2) + labs(x = "Longitude", y = "Latitude", title = "Cuba") + coord_quickmap() + theme_bw() + theme(plot.title = element_text(hjust = 0.5)) pan_file <- system.file("extdata", "gadm36_PAN_1.shp", package = "smoothMap") pan_data <- team_4(pan_file, tolerance = 0.01) ggplot(pan_data, aes(x = long, y = lat, group = group)) + geom_polygon(color = "black", fill = "white", size = 0.2) + labs(x = "Longitude", y = "Latitude", title = "Panama") + coord_quickmap() + theme_bw() + theme(plot.title = element_text(hjust = 0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.