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