Skip to contents

Regular Grid

Usage

bt_regulargrid(
  bertin,
  data,
  step = 20,
  values,
  operator = "sum",
  geoprocessing = "intersection",
  blur = 0,
  colors = "Tableau10",
  order,
  col_missing = "#f5f5f5",
  txt_missing = "No data",
  stroke = "white",
  strokeWidth = 0.5,
  fillOpacity = 1,
  tooltip,
  leg_x,
  leg_y,
  leg_w = 30,
  leg_h = 20,
  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

step

gap between graticules. The value can be a number or an array of two values

values

a string corresponding to the targeted variable in the properties

operator

'sum' for absolute quantitative data or 'mean

geoprocessing

'intersection' intersection between polygons and grid squares. Assignment of values in proportion to the intersected area) or 'dotinpoly' (considers each grid square and assigns the value of the underlying polygon or the weighted average of intersecting polygons. ).

blur

radius of the kernel defined

colors

define the pallette of categorical colors

order

an array of values to set the order of the colors

col_missing

Color for missing values

txt_missing

Text for missing values

stroke

stroke color

strokeWidth

stroke width

fillOpacity

fill opacity

tooltip

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

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_w

width of the box

leg_h

height of the box

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_regulargrid(data = world, values = "pop",
                 step = 20,
                fill = list(
                   nbreaks = 6,
                   method = "quantile",
                   colors = "Blues"
                 ),
                 tooltip = "$value") |>
  bt_draw()