suppressWarnings(library(tidyverse))
## -- Attaching packages --------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.1.1       v purrr   0.3.2  
## v tibble  2.1.1       v dplyr   0.8.0.1
## v tidyr   0.8.3       v stringr 1.4.0  
## v readr   1.3.1       v forcats 0.4.0
## -- Conflicts ------------------------------------------------------------------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(highcharter)
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
library(MASS)
## Warning: package 'MASS' was built under R version 3.5.3
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
ds1 <- as_tibble(round(mvrnorm(n = 20, mu = c(1, 1), Sigma = matrix(c(1,0,0,1),2)), 2))
## Warning: `as_tibble.matrix()` requires a matrix with column names or a `.name_repair` argument. Using compatibility `.name_repair`.
## This warning is displayed once per session.
ds2 <- as_tibble(round(mvrnorm(n = 10, mu = c(3, 4), Sigma = matrix(c(2,.5,2,2),2)), 2))

highchart() %>%
  hc_chart(zoomType = "xy") %>%
  hc_tooltip(
    useHTML = TRUE,
    pointFormat = paste0(
      "<span style=\"color:{series.color};\">{series.options.icon}</span>",
      "{series.name}: <b>[{point.x}, {point.y}]</b><br/>"
    )
  ) %>%
  hc_add_series(
    data = ds1,
    type = "point",
    hcaes(V1, V2), 
    marker = list(symbol = fa_icon_mark("bath")),
    icon = fa_icon("bath"),
    name = "bath"
  ) %>%
  hc_add_series(
    data = ds2,
    type = "point",
    hcaes(V1, V2), 
    marker = list(symbol = fa_icon_mark("shower")),
    icon = fa_icon("shower"),
    name = "shower"
  ) %>%
  hc_add_dependency_fa()
data <- bind_rows(
  ds1 %>% mutate(ico = "bath"),
  ds2 %>% mutate(ico = "shower")
)

hchart(data, "point", hcaes(V1, V2, group = ico))
data <- data %>% 
  mutate(
    icon = fa_icon(ico),
    marker =  map(ico, ~ list(symbol = fa_icon_mark(.x)))
  )


hchart(data, "point", hcaes(V1, V2, group = ico)) %>% 
  hc_add_dependency_fa()