Link

https://github.com/lydiaPenglish/smoothMap

Team Members

knitr::opts_chunk$set(warning = F, message = F, fig.align = "center")

Description

The goal of smoothMap is to generate a function to help map files.

Installation

You can install the released version of smoothMap from Github with:

devtools::install_github("lydiaPenglish/smoothMap")

Example

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))


lydiaPenglish/smoothMap documentation built on May 9, 2019, 1:10 a.m.