Skip to contents

Mushroom

Usage

bt_mushroom(
  bertin,
  data,
  top_values,
  bottom_values,
  top_fill = "#d64f4f",
  bottom_fill = "#4fabd6",
  k = 50,
  stroke = "white",
  strokeWidth = 0.5,
  fillOpacity = 1,
  strokeOpacity = 1,
  top_tooltip,
  bottom_tooltip,
  display = TRUE,
  leg_x,
  leg_y,
  leg_fill = "none",
  leg_stroke = "black",
  leg_strokeWidth = 0.8,
  leg_txtcol = "#363636",
  leg_title,
  leg_round,
  leg_fontSize = 14,
  leg_fontSize2 = 10,
  leg_top_txt = top_values,
  leg_bottom_txt = bottom_values,
  leg_bottom_fill,
  leg_top_fill
)

Arguments

bertin

map object

data

sf object EPSG:4326

top_values

a string corresponding to the targeted top variable in the properties (compulsory)

bottom_values

a string corresponding to the targeted bottom variable in the properties(compulsory)

top_fill

top fill color

bottom_fill

bottom fill color

k

size of the largest object

stroke

stroke color

strokeWidth

stroke width

fillOpacity

fill opacity

strokeOpacity

stroke opacity

top_tooltip

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

bottom_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

leg_fontSize2

legend text font size

leg_top_txt

title for the top variable

leg_bottom_txt

title for the bottom variable

leg_bottom_fill

color of bottom semi circles

leg_top_fill

color of top semi circles

Value

a map object

Examples

library(sf)
world <- st_read(system.file("gpkg/world.gpkg", package = "bertin"),
                 layer = "world", quiet = TRUE)
africa <- subset(world, region == "Africa")
africa$pop_pct <- (africa$pop / sum(africa$pop, na.rm = TRUE)) * 100
africa$gdp_pct <- (africa$gdp / sum(africa$gdp, na.rm = TRUE)) * 100
bt_layer(data = africa, fill = "#808080") |>
  bt_mushroom(data = africa, top_values = "gdp_pct", bottom_values = "pop_pct") |>
  bt_draw()