Accepted answer

after further investigation, and following a post and answer by the person maintaining the package, @jbkunst, there is a fix that requires to pull the latest version of the package.

this is the code:


additional information is available at this link:

edit: this is no longer true, when you download the updated version of the package from jbkunst's github repository, the package works with flexdashboard as well.

however, please note that for my specific problem, which was embedded in the production of a flexdashboard, pulling the latest version of the package seems to introduce an error whereby the first plot appears properly, and the following plots do not. this error is not consistent, so it may or may not occur on your end. i have added a post on the github page for the package, with a functional example if you're interested:

edit: this issue has been resolved

in order to solve this issue for my specific case, i pulled the newest version of the package, then saved the map data as an excel file for all the maps i needed. i then relied on the json versions, which do work, to produce the maps: here's an example with tiles:


de_map_js <- read_excel("your path/map.xlsx") # opening js map from excel

map_data <- as_tibble(data.frame(name = de_map_js$name,
                                 values = sample(c(50:200), 16, replace = t))) # creating fake data by region for germany

de_map <- "" %>% #downloading the german map as json
  get() %>% 

highchart(type = "map") %>% 
  hc_title(text = "title") %>%
  hc_subtitle(text = "subtitle") %>%
  hc_add_series_map(map = de_map, df = map_data, joinby = "name", value = "values", # map = json map ; df = data.frame with correct region names ; values = your data values
                    datalabels = list(enabled = true
                                      ,format = "{}") # adding region initials on map
  ) %>%
  hc_coloraxis(stops = color_stops(colors = viridislite::rocket(213, direction = -1,
                                                                begin = 0.2,
                                                                end = 1))) %>%
  hc_mapnavigation(enabled = true)

enter image description here

and here's an example with city bubbles:


df_fake <- data.frame(
  name = c("cologne"),
  lat = c(50.9375),
  lon = c(6.9603),
  z = c(1)
) # creating fake tile data

df <- data.frame(
  name = c("berlin", "frankfurt", "munich", "cologne"),
  lat = c(52.5200, 50.1109, 48.1351, 50.9375),
  lon = c(13.4050, 8.6821, 11.5820, 6.9603),
  z = c(1000, 500, 750, 1250)
) # creating bubble map series

de_map_json <- "" %>% #downloading the german map as json
  get() %>% 

highchart(type = "map") %>%
  hc_add_series_map(map = de_map_json, df = df_fake, joinby = "name", value = "z") %>% # the fake data goes into the map generation, with the real map as json
    data = df, # here you can add your data
    type = "mapbubble", # the type of plot
    name = "city", 
    minsize = "1%",
    maxsize = "5%",
    tooltip = list(
      pointformat = "{}: {point.z:,.0f}"  # hover options
    )) %>%
  hc_mapnavigation(enabled = true) %>%
  hc_coloraxis(stops = color_stops(colors = viridislite::turbo(10, begin = 0.4, end = 0.9))) %>%
  hc_title(text = "title")

enter image description here

this was all achieved by savings the js maps as excel from the newer version of the package (see above), deleting and reinstalling the old version of the package, and finally generating the maps using json data instead of js.

all maps can be found here:


you can try importing this script from highcharts js api and see if it works correctly then. here you can find an article explaining how to work with js in r:

Related Query

More Query from same tag