Skip to content

Instantly share code, notes, and snippets.

@oneryalcin
Created July 22, 2020 23:17
Show Gist options
  • Save oneryalcin/d610b2240f77ddb8086b03195c9d22e6 to your computer and use it in GitHub Desktop.
Save oneryalcin/d610b2240f77ddb8086b03195c9d22e6 to your computer and use it in GitHub Desktop.
highcharter example UK MAP
library(highcharter)
library(dplyr)
mapdata <- get_data_from_map(download_map_data("countries/gb/gb-all"))
set.seed(1234)
data_fake <- mapdata %>%
select(code = `hc-a2`) %>%
mutate(value = 1e5 * abs(rt(nrow(.), df = 10)))
hcmap("countries/gb/gb-all", data = data_fake, value = "value",
joinBy = c("hc-a2", "code"), name = "Fake data",
dataLabels = list(enabled = TRUE, format = '{point.name}'),
borderColor = "#FAFAFA", borderWidth = 0.1,
tooltip = list(valueDecimals = 0, valuePrefix = "£", valueSuffix = " GBP"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment