Add a bivariate legend
Usage
add_bivariate_legend(
map,
scale,
legend_title = NULL,
x_title = NULL,
y_title = NULL,
position = "top-left",
width = NULL,
style = NULL,
add = FALSE,
unique_id = NULL,
layer_id = NULL,
target = "compare",
draggable = FALSE,
collapsible = FALSE,
collapsed = FALSE,
min_zoom = NULL,
max_zoom = NULL
)Arguments
- map
A map object created by
mapboxgl()ormaplibre(), a compare object, or a proxy object.- scale
A
mapgl_bivariate_scaleobject frombivariate_scale().- legend_title
Optional legend title.
- x_title
Label for the horizontal axis. Defaults to the x column name.
- y_title
Label for the vertical axis. Defaults to the y column name.
- position
The legend position.
- width
Legend width. Defaults to
"fit-content"(capped at 340px) so titles and axis labels stay on one line.- style
Optional styling options from
legend_style()or a list.- add
Logical, whether to add to existing legends.
- unique_id
Optional unique legend ID.
- layer_id
Optional associated layer ID for layer-control show/hide.
- target
For compare objects, one of
"compare","before", or"after"; for synced grids with more than two maps, a map identifier such as"map3"can also be used.- draggable
Logical, whether the legend can be dragged.
- collapsible
Logical, whether the legend can collapse.
- collapsed
Logical, whether the legend starts collapsed.
- min_zoom
The minimum zoom level at which the legend is displayed.
- max_zoom
The maximum zoom level at which the legend is displayed. The legend is hidden when the map zoom is at or above this value.
