Cartogram htmlwidget for visualizing geographical data by distorting a TopoJson topology
topogRam.Rd
Continuous area cartograms with d3.js
and cartogram-chart
.
Usage
topogram(
sfobj,
value,
label = "{value}",
palette = "viridis",
rescale_to = c(1, 1000),
n_iteration = 10,
projection = "geoMercator",
layerId = NULL,
width = NULL,
height = NULL,
elementId = NULL
)
Arguments
- sfobj
An
sf
object. For the time being, shape must be projected in Mercator (CRS 4326).- value
Variable name to use to distort topology.
- label
glue
string to be used in tooltip, you can use HTML tags in it.- palette
Name of a color palette, such as
"viridis"
,"Blues"
, ... Or a function to map data values to colors, seescales::col_numeric()
.- rescale_to
Rescale value to distort topology to a specified range, use
NULL
to use values as is.- n_iteration
Number of iterations to run the algorithm for. Higher numbers distorts the areas closer to their associated value, at the cost of performance.
- projection
Name of a projection, see available ones here: https://github.com/d3/d3-geo-projection.
- layerId
A formula, the layer id to specify value returned by
input$<ID>_click
in 'shiny' application.- width
A numeric input in pixels.
- height
A numeric input in pixels.
- elementId
Use an explicit element ID for the widget.