points_layer | R Documentation |
Add a points layer to a d3-carto-map.
points_layer(carto, data, x = "long", y = "lat", label = "Points", color = "red", size = 4, radius_field = NULL, clickable = TRUE, visible = TRUE, cluster = FALSE, opacity = 0.5, radius_func = "d3.scale.sqrt().domain([0, layer.radius_domain]).range([0, layer.size])")
carto |
The map created by |
data |
A data frame with columns for the latitude and longitude in decimal degrees. It may also contain other columns to be used as properties. |
x |
The name of the column in the data frame with the longitudes. |
y |
The name of the column in the data frame with the latitudes. |
label |
The label for this layer on the layer selector. |
color |
The color of the points, either as a name recognized by a
browser or as a hexadecimal string (e.g., |
size |
The radius of the points. If the parameter |
radius_field |
The name of a numeric field in the data frame passed to
|
clickable |
Controls whether a point can be clicked to show the properties in the data frame. |
visible |
Should the layer be initially visible? |
cluster |
If true, when the map is zoomed points will be clustered on a quadtree. If the points are clustered, arguments that control the size of points will be disregarded. |
opacity |
The opacity of points on the map: a number between 0 and 1. |
radius_func |
A D3 quantitative scale function to control the radius of the points. |
if(require(historydata)) { cartographer(region = "United States") %>% tile_layer() %>% points_layer(data = paulist_missions, x = "long", y = "lat", color = "blue", label = "Missions", radius_field = "confessions", size = 8) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.