Ggplotly - show interactive datapoints only for a data subset


I am trying to create a plotly figure with ggplot, where I only want to show hover data on some specific data points.

In the toy example below, how can I show information on mouse hovering only for sepal.Length < 6 and Petal.width < 1.5, but not for the rest of the data points? I haven found posts to show information only on specific traces, but not on specific subset of the same trace.


p1 <- ggplot(iris, aes(Sepal.Length, Petal.Width))+

ggplotly(p1) %>%
  style(hoverinfo = "none", traces = 2)

Any help would be much appreciated!

P.D. I’m using Plotly version 4.10.2; ggplot version 3.3.3. Mac operating system.