linework_map: Retrieve a linework map as a regular or fortified...

Description Usage Arguments Value Note See Also Examples

View source: R/linework.R

Description

Project Linework is "A library of handcrafted vector linework for cartography, each designed in a unique aesthetic style. They are meant to break us away from default line paths that we so often rely on by providing more visually-interesting alternatives."

Usage

1
2
linework_map(linework_set = "elmer_casual", admin_level = 1,
  fortified = FALSE)

Arguments

linework_set

one of "charmingly_inaccurate", "elmer_casual", "geo_metro", "moriarty_hand", "times_approximate", "twenty_seventy", "wargames", "weekend_update"

admin_level

either 0 or 1 for the shapefile admin level

fortified

TRUE if the function should return a "fortified" object (i.e. ready for use with ggplot)

Value

SpatialPolygonsDataFrame or regular data.frame

Note

Unfortunately, there was no regulation within Project Linework to standardize on the format for the shapefile data columns, so you'll have to inspect the @data element of the non-fortified returned object or the str of the fortified returned object to get an idea for fields that you can subset on. You can perform this inspection with a call to lineworks.

See Also

Project Linework for more information about the shapefiles

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(sp)

# plot admin1 polygons for Elmer Casual (the defaults)
plot(linework_map())

# plot the continental United States "Wargames" style
library(ggplot2)
library(ggthemes)
wargames <- linework_map("wargames", fortified=TRUE)
us <- wargames[wargames$iso_a2=="US" & !wargames$code_hasc %in% c("US.HI", "US.AK"),]
ggplot(us) +
  geom_map(map=us, aes(x=long, y=lat, map_id=id)) +
  coord_map(project="albers", lat0=37.5, lat1=29.5) +
  theme_map()

# fancier example
elmer <- linework_map("elmer_casual", fortified=TRUE)
us <- elmer[elmer$COUNTRY=="US" & elmer$Name != "Alaska",]
gg <- ggplot()
gg <- gg + geom_map(data=us, map=us,
                    aes(x=long, y=lat, map_id=id),
                    color="#939598", fill="#d1d2d4", size=0.5)
gg <- gg + coord_map(project="albers", lat0=37.5, lat1=29.5)
gg <- gg + labs(title="Elmer Casual")
gg <- gg + theme_map()
gg <- gg + theme(plot.title=element_text(size=16))
gg

hrbrmstr/lineworkmaps documentation built on May 16, 2017, 1:20 a.m.