Description Usage Arguments Value Note See Also Examples
Create hexbin layers for leaflet plots.
1 2 3 4 5 6 | addHexbin(map, data = NULL, radius = 12, opacity = 0.5,
duration = 500, lowEndColor = "white", highEndColor = "blue",
uniformSize = FALSE, uniformColor = NULL,
sizeSummaryFunction = c("count", "sum", "max", "min", "mean",
"median"), sizevar = NULL, colorSummaryFunction = c("count", "sum",
"max", "min", "mean", "median"), colorvar = NULL)
|
map |
The leaflet map object to apply the hexbin layer to.
Makes this function compatible with the |
data |
data frame or tibble - alternate data to use for this hexbin instead of default map data |
radius |
choose the base size for the hexagons |
opacity |
decimal between 0.0 and 1.0 - choose the percent of opacity for the hexagons |
duration |
positive integer milliseconds that the animation takes for drawing the hexagons |
lowEndColor |
choose the color for the smaller hexagons |
highEndColor |
choose the color for the larger hexagons |
uniformSize |
a logical indicating whether all hexagons should be the same size. |
uniformColor |
a color that overrides lowEndColor and highEndColor to make the color uniform across the hexagon sizes. |
sizeSummaryFunction |
a string that specifies which summary function to use on sizevar to modulate the size of the hexagons. The options are 'count', 'sum', 'max', 'min', 'mean', and 'median'. |
sizevar |
a string that specifies which variable in the user specified data frame will be used to calculate the size of the hexagons. |
colorSummaryFunction |
a string that specifies which summary function to use on colorvar to modulate the color of the hexagons. The options are 'count', 'sum', 'max', 'min', 'mean', and 'median'. |
colorvar |
a string that specifies which variable in the user specified data frame will be used to calculate the color of the hexagons. |
map parameter, but with the hexbinLayer attached so that it can be
used with the %>%
pipe operator
Do not use uniformColor and uniformSize together as it will not give any insights to the data
If colorSummaryFunction and colorvar are not specified,
the color will mirror the sizevar unless uniform color set to TRUE
.
A JSFiddler Hexbin example by Ryan
1 2 3 4 5 | leaflet::leaflet(data.frame(lat = 42.9634 + rnorm(1000),lng = -85.6681 + rnorm(1000))) %>%
addTiles() %>% addHexbin()
leaflet::leaflet(data.frame(lat = 42.9634 + rnorm(1000),lng = -85.6681 + rnorm(1000))) %>%
addTiles() %>% addHexbin(radius=25, lowEndColor='purple', highEndColor='orange')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.