Skip to contents

Square

Usage

bt_square(
  bertin,
  data,
  values,
  k = 50,
  fixmax,
  fill,
  stroke = "white",
  strokeWidth = 0.5,
  fillOpacity = 1,
  demers = FALSE,
  iteration = 200,
  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_divisor = 1,
  leg_fontSize = 14,
  leg_fontSize2 = 10
)

Arguments

bertin

map object

data

sf object EPSG:4326

values

a string corresponding to the targeted variable in the properties

k

size of the largest object

fixmax

Max value to fix the size of the biggest circle, in order to make maps comparable

fill

fill color

stroke

stroke color

strokeWidth

stroke width

fillOpacity

fill opacity

demers

avoid overlapping between quares. a boolean

iteration

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

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_divisor

A number to divide to the values in the legend. For example, 1000 is used to convert units to thousands.1000000 allows to convert units into millions

leg_fontSize

legend title font size

leg_fontSize2

legend text 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_square(data = world, values = "pop", k = 60, tooltip = "$name") |>
bt_draw()