The complete, validated render spec for a MapLibre choropleth: a MapModel
(the data) plus all visual styling and an optional title. This is the
MapLibre analog of EChartsOption / SigmaOption – the single object
draw() dispatches on to emit a rtemis-map widget. Theme is not a
property here; like every backend, theming is supplied to draw() and
resolved uniformly.
Usage
MapLibreOption(
model = NULL,
classification = "quantile",
colormap = "blues",
num_classes = 5,
opacity = 1,
show_boundaries = TRUE,
outline_width = 0.2,
show_legend = TRUE,
legend_position = "bottom-right",
tooltip_position = "top-right",
title = NULL
)Arguments
- model
MapModel or named list: The choropleth data (a list must contain a
rowselement).- classification
Character {"quantile", "equal", "jenks"}: Class-break method.
"quantile"(equal counts),"equal"(equal intervals), or"jenks"(natural breaks).- colormap
Character: Color ramp. One of the sequential schemes
"blues","viridis","ylorrd","greens","magma", or the diverging schemes"rdbu","rdylgn","spectral","brbg".- num_classes
Numeric [2, 12]: Number of color classes.
- opacity
Numeric [0, 1]: Region fill opacity.
- show_boundaries
Logical: Whether to draw region outlines.
- outline_width
Numeric [0, Inf): Region outline width in pixels.
- show_legend
Logical: Whether to show the legend.
- legend_position
Character {"top-left", "top-right", "bottom-left", "bottom-right"}: Legend corner.
- tooltip_position
Character {"top-left", "top-right", "bottom-left", "bottom-right"}: Hover tooltip corner.
- title
Optional Character: Title (currently surfaced via the value label; reserved for future use).
Details
Most users never touch this directly – draw_choropleth() and draw_map()
build it – but power users can construct it for full control:
draw(MapLibreOption(model = MapModel(...), colormap = "viridis")).
Its to_list() produces the { model, style, title } payload consumed by
the rtemis-map htmlwidget binding (the geometry is added by the draw()
method, since it depends only on the model's resolution).
Examples
model <- MapModel(
rows = list(
MapRow(location = "USA", value = 25.5),
MapRow(location = "CAN", value = 12.1)
)
)
MapLibreOption(model = model, classification = "quantile")#> <rtemis.draw::MapLibreOption>
#> @ model : <rtemis.draw::MapModel>
#> .. @ rows :List of 2
#> .. .. $ : <rtemis.draw::MapRow>
#> .. .. ..@ location: chr "USA"
#> .. .. ..@ value : num 25.5
#> .. .. ..@ extras : NULL
#> .. .. $ : <rtemis.draw::MapRow>
#> .. .. ..@ location: chr "CAN"
#> .. .. ..@ value : num 12.1
#> .. .. ..@ extras : NULL
#> .. @ resolution : chr "country"
#> .. @ value_label : chr "value"
#> .. @ tooltip_fields: chr(0)
#> @ classification : chr "quantile"
#> @ colormap : chr "blues"
#> @ num_classes : num 5
#> @ opacity : num 1
#> @ show_boundaries : logi TRUE
#> @ outline_width : num 0.2
#> @ show_legend : logi TRUE
#> @ legend_position : chr "bottom-right"
#> @ tooltip_position: chr "top-right"
#> @ title : NULL