title: Hover text over geom_segment in plotly
body: <p>The code below creates a <code>plotly</code> figure of a line using <code>geom_segment</code> with hover text.</p>
  
  <pre><code># Load libraries
  library(ggplot2)
  library(plotly)
  
  # Create data frame
  df &lt;- data.frame(xmin = 0, xmax = 1, y = 1, label = "Hover!")
  
  # Create plot with hover
  g &lt;- ggplot(df) + geom_segment(aes(x = xmin, xend = xmax, 
                                     y = y, yend = y, text = label))
  ggplotly(g, tooltip = "text")
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/CbUxm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CbUxm.png" alt="enter image description here"></a></p>
  
  <p>When I hover over either end point of the segment, the text appears as expected. </p>
  
  <p><strong>My question:</strong> How do I make the text appear when hovering over <em>any</em> part of the segment? I could create and plot a data frame with lots of points along the segment so that when I hover over the line I'll be also hovering over one of these points, but that's quite cludgy. Is there a better way?</p>