Skip to contents

Texts

Usage

bt_text(
  bertin,
  text,
  position = c(100, 200),
  fontSize = 15,
  fontFamily = "Roboto",
  textDecoration = "none",
  fontWeight = "normal",
  fontStyle = "none",
  margin = 0,
  anchor = "start",
  fill = "#474342",
  stroke = "none",
  frame_fill = "none",
  frame_stroke = "none",
  frame_strokeWidth = 1,
  frame_opacity = 1,
  display = TRUE
)

Arguments

bertin

map object

text

text to display

position

position of the text. It can be an array with x,y coordinates. For example [100,200]. It can be also a string defining the position.'topleft', 'top', 'topright', 'left', 'middle', 'right', 'bottomleft', 'bottom', 'bottomright'

fontSize

text size

fontFamily

font family

textDecoration

text decoration.

fontWeight

font weight. "normal", "bold", "bolder", "lighter"

fontStyle

font style

margin

margin

anchor

text anchor. start, middle, end

fill

fill color

stroke

stroke color

frame_fill

frame background color

frame_stroke

frame stroke color

frame_strokeWidth

thickness of the frame contour

frame_opacity

frame opacity

display

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

Value

map object

Examples

library(sf)
world <- st_read(system.file("gpkg/world.gpkg", package = "bertin"),
                 layer = "world", quiet = TRUE)
bt_param(projection = "Mercator", clip = TRUE) |>
  bt_layer(data = world) |>
  bt_text(text = "This is my text", position = "bottomright",
          fontSize = 20, frame_stroke = "red", margin = 4) |>
  bt_draw()