score:1

Accepted answer

change type = "bubble" to type = "scatter" and hc_yaxis as below

hchart(data, "scatter", hcaes(x, y)) %>%
  hc_yaxis(
    plotlines = list(
      list(color = "#252525",
           width = 2,
           value = 0)
    )
  )

score:0

the above answer is correct, but not perfect so i decided to add my own with more information.

you don't have to change the series type from 'bubble' to 'scatter'. it works fine with 'bubble'.

your code didn't work because, in highcharts, plotlines needs to be an array of objects. in r lists imitate js' arrays and objects so you need a list of lists. also, you don't need to define 'color' and 'width'. i don't remember when exactly, but few months ago highcharts added default values for them and all you need to define is just 'value'.

hc_yaxis(plotlines = list(list(value = 10)))

api reference: https://api.highcharts.com/highcharts/yaxis.plotlines


Related Query

More Query from same tag