add_arcs_name: Add arcs

Description Usage Arguments Examples

View source: R/add.R

Description

Add arcs by name of country of state.

Usage

1
add_arcs_name(p, origin, destination, ...)

Arguments

p

a datamaps object.

origin, destination

edges.

...

any other arguments to use as options.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data <- data.frame(origin = c("USA", "FRA", "CHN", "RUS", "COG", "DZA"),
    target = c("FRA", "RUS", "BEL", "CAF", "VEN", "SWZ"),
    greatArc = rep(c(TRUE, FALSE), 3),
    arcSharpness = 2)

data %>%
    datamaps() %>%
    add_arcs_name(origin, target, greatArc, arcSharpness)

# US states
states <- data.frame(origin = c("AR", "NY", "CA", "IL", "CO", "MT",
                                "TX", "WA", "TN", "MT"),
    target = c("OR", "SD", "WI", "TX", "LA", "AZ", "FL", "MI", "HI",
               "OK"),
    strokeWidth = runif(10, 1, 9),
    strokeColor = colorRampPalette(c("red", "blue"))(10))

states %>%
    datamaps(scope = "USA", default = "lightgray") %>%
    add_arcs_name(origin, target, strokeWidth, strokeColor)

JohnCoene/datamaps documentation built on May 7, 2019, 11:58 a.m.