dplot3_leaflet: Plot interactive choropleth map using 'leaflet'

View source: R/dplot3_leaflet.R

dplot3_leafletR Documentation

Plot interactive choropleth map using leaflet

Description

Plot interactive choropleth map using leaflet

Usage

dplot3_leaflet(
  fips,
  values,
  names = NULL,
  fillOpacity = 1,
  palette = NULL,
  color.mapping = c("Numeric", "Bin"),
  col.lo = "#0290EE",
  col.hi = "#FE4AA3",
  col.na = "#303030",
  col.highlight = "#FE8A4F",
  col.interpolate = c("linear", "spline"),
  col.bins = 21,
  domain = NULL,
  weight = 0.5,
  color = "black",
  alpha = 1,
  bg.tile.provider = leaflet::providers$Stamen.TonerBackground,
  bg.tile.alpha = 0.67,
  fg.tile.provider = leaflet::providers$Stamen.TonerLabels,
  legend.position = c("topright", "bottomright", "bottomleft", "topleft"),
  legend.alpha = 0.8,
  legend.title = NULL,
  init.lng = -98.5418083333333,
  init.lat = 39.2074138888889,
  init.zoom = 3,
  stroke = TRUE
)

Arguments

fips

Character vector of FIPS codes. (If numeric, it will be appropriately zero-padded)

values

Values to map to fips

names

Character vector: Optional county names to appear on hover along values

fillOpacity

Float: Opacity for fill colors. Default = 1

palette

Character: Color palette to use

color.mapping

Character: "Numeric" or "Bin"

col.lo

Overlay color mapped to lowest value

col.hi

Overaly color mapped to highest value

col.na

Color mappes to NA values

col.highlight

Hover border color. Default = "#FE8A4F" (orange)

col.interpolate

Character: "linear" or "spline"

col.bins

Integer: Number of color bins to create if color.mapping = "Bin". Default = 21

domain

Limits for mapping colors to values. Default = NULL and set to range

weight

Float: Weight of county border lines. Default = .5

color

Color of county border lines. Default = "black"

alpha

Float: Overaly transparency. Default = 1

bg.tile.provider

Background tile (below overlay colors), one of leaflet::providers

bg.tile.alpha

Float: Background tile transparency. Default = .67

fg.tile.provider

Foreground tile (above overlay colors), one of leaflet::providers

legend.position

Character: One of: "topright", "bottomright", "bottomleft", "topleft". Default = "topright"

legend.alpha

Float: Legend box transparency. Default = .8

legend.title

Character: Defaults to name of values variable.

init.lng

Float: Center map around this longitude (in decimal form). Default = -98.54180833333334 (US geographic center)

init.lat

Float: Center map around this latitude (in decimal form). Default = 39.207413888888894 (US geographic center)

init.zoom

Integer: Initial zoom level (depends on device, i.e. window, size). Default = 3

stroke

Logical: If TRUE, draw polygon borders. Default = TRUE

Author(s)

E.D. Gennatas

Examples

## Not run: 
fips <- c(06075, 42101)
population <- c(874961, 1579000)
names <- c("SF", "Philly")
dplot3_leaflet(fips, supervals, names)

## End(Not run)


egenn/rtemis documentation built on May 4, 2024, 7:40 p.m.