View source: R/addpoly_legend.R
addcluster_legend | R Documentation |
Adds marker layer and legend to leaflet map, with points in cluster layer shaded by palette function
addcluster_legend( leafletobj, var, pal_funct, grp, labvar, popuptext, clusterpoints = T, title = grp, radius = 0.1, weight = 20, df = leaflet::getMapData(leafletobj), ... )
leafletobj |
Leaflet object |
var |
String name of variable colored in cluster layer |
pal_funct |
Palette function to color cluster layer |
grp |
Group of cluster layer |
labvar |
Label to show when hover over a point; can feed either a data-masked variable name, or a set of labels created by leafletwrappers::label_standard function |
popuptext |
Labels to show in pop-up over point, created by leafletwrappers::label_output function |
clusterpoints |
Whether to cluster points; default true |
title |
Title of legend; default grp |
radius |
Radius of points; default 0.1. To size by a variable, can feed a formula with the sqrt() of a data-masked variable; e.g., ~ sqrt(unitsize) |
weight |
Weight of points; default 20 |
df |
Spatial dataframe behind layer; default leaflet::getMapData(leafletobj) |
... |
Additional .label or .popup arguments for leafletwrappers::addcluster_standard, or opacity argument for leafletwrapper::addlegend_standard |
Leaflet object with cluster layer and legend
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.