Learn R Programming

epiflows (version 0.2.2)

map_epiflows: Map flows of people between locations

Description

The function map_epiflows uses leaflet to generate an interactive map displaying flows of people travelling between locations stored in a epiflows object. Note that the object needs to possess geographic coordinates.

Usage

map_epiflows(
  x,
  title = "",
  center = NULL,
  sort = TRUE,
  pal = "YlOrBr",
  adjust_width = TRUE,
  ...
)

Value

A leaflet object

Arguments

x

An epiflows object.

title

Plot title.

center

An optional set of coordinates or character string specifying ID to use as the center of the map

sort

a logical. When TRUE (default), the flows will be sorted in order of number of cases on the map so that the largest flows appear on top.

pal

a color palette to pass on to leaflet::colorQuantile(). This can be the name of a viridis or RColorBrewer palette, a vector of hex colors, or a color-generating functon.

adjust_width

a logical specifying if the width of the flows should be adjusted to reflect the number of flows between locations. Defaults to TRUE.

...

Additional parameters (not used).

Author

Paula Moraga, Pawel Piatkowski, Salla Toikkanen, Zhian Kamvar

Examples

Run this code
data("Brazil_epiflows")
data("YF_coordinates")
ef <- add_coordinates(Brazil_epiflows, YF_coordinates[-1])
plot(ef)
map_epiflows(ef, center = "Espirito Santo", title = "Flows to and from Brazil")

Run the code above in your browser using DataLab