Skip to contents

Dot cartogram

Usage

bt_dotcartogram(
  bertin,
  data,
  onedot,
  nbmax = 200,
  iteration = 200,
  values,
  radius = 4,
  span = 0.5,
  fill,
  stroke = "white",
  strokeWidth = 0.5,
  fillOpacity = 1,
  tooltip,
  display = TRUE,
  leg_x,
  leg_y,
  leg_fill = "none",
  leg_stroke = "black",
  leg_strokeWidth = 0.8,
  leg_txtcol = "#363636",
  leg_title = values,
  leg_round,
  leg_fontSize = 10
)

Arguments

bertin

map object

data

sf object EPSG:4326

onedot

dot value (if onedot is filled, nbmax is useless)

nbmax

number max of circles on the map

iteration

an integer to define the number of iteration for the Dorling method

values

a string corresponding to the targeted variable in the properties

radius

radius of dots

span

spacing between dots

fill

fill color

stroke

stroke color

strokeWidth

stroke width

fillOpacity

fill opacity

tooltip

tooltip allows you to display a label when you fly over an object

display

Boolean to allow to show or hide the layer. This parameter has no effect on the calculation of the extent

leg_x

position in x (if this value is not filled, the legend is not displayed)(value in px)

leg_y

position in y (if this value is not filled, the legend is not displayed)(value in px)

leg_fill

color of the circles

leg_stroke

stroke color of the circles

leg_strokeWidth

stoke-width of the legend

leg_txtcol

color of the text

leg_title

title of the legend

leg_round

number of digits after the decimal point

leg_fontSize

legend title font size

Value

a map object

Examples

library(sf)
world <- st_read(system.file("gpkg/world.gpkg", package = "bertin"),
                 layer = "world", quiet = TRUE)
bt_layer(data = world, fill = "#808080") |>
  bt_dotcartogram(data = world,
                  onedot = 100000000000,
                  iteration = 200, values = "gdp") |>
  bt_draw()