draw_leaflet | R Documentation |
Plot interactive choropleth map using leaflet
draw_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
)
fips |
Character vector of FIPS codes. (If numeric, it will be appropriately zero-padded). |
values |
Values to map to |
names |
Character vector: Optional county names to appear on hover along |
fillOpacity |
Float: Opacity for fill colors. |
palette |
Character: Color palette to use. |
color_mapping |
Character: "Numeric" or "Bin". |
col_lo |
Overlay color mapped to lowest value. |
col_hi |
Overlay color mapped to highest value. |
col_na |
Color mapped to NA values. |
col_highlight |
Hover border color. |
col_interpolate |
Character: "linear" or "spline". |
col_bins |
Integer: Number of color bins to create if |
domain |
Limits for mapping colors to values. Default = NULL and set to range. |
weight |
Float: Weight of county border lines. |
color |
Color of county border lines. |
alpha |
Float: Overlay transparency. |
bg_tile_provider |
Background tile (below overlay colors), one of |
bg_tile_alpha |
Float: Background tile transparency. |
fg_tile_provider |
Foreground tile (above overlay colors), one of |
legend_position |
Character: One of: "topright", "bottomright", "bottomleft", "topleft". |
legend_alpha |
Float: Legend box transparency. |
legend_title |
Character: Defaults to name of |
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). |
stroke |
Logical: If TRUE, draw polygon borders. |
leaflet
object.
EDG
## Not run:
fips <- c(06075, 42101)
population <- c(874961, 1579000)
names <- c("SF", "Philly")
draw_leaflet(fips, population, names)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.