title: How do I highlight an entire trace upon hover in Plotly for Python?
body: <p>I want a trace to be highlighted (color or opacity change) when selected with mouse hover.  I have looked into <code>restyle</code> functionality, but it may not be appropriate for my use case.</p>
  
  <p><a href="https://i.stack.imgur.com/4RtYo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4RtYo.png" alt="enter image description here"></a></p>
  
  <p>It looks like <a href="https://github.com/plotly/plotly.js/issues/1847" rel="noreferrer">this has been discussed on Github</a>, but I'm not sure if it has been resolved/implemented.</p>
  
  <p>Here is an example in Bokeh of what I want to accomplish in Plotly Python:</p>
  
  <pre><code>from bokeh.plotting import figure, show, output_notebook
  from bokeh.models import HoverTool
  from bokeh.models import ColumnDataSource
  output_notebook()
  
  p = figure(plot_width=400, plot_height=400,y_range=(0.2,0.5))
  
  
  y_vals = [0.22,0.22,0.25,0.25,0.26,0.26,0.27,0.27]
  y_vals2 = [y*1.4 for y in y_vals]
  x_vals = [0,1,1,2,2,2,2,3]
  data_dict = {'x':[x_vals,x_vals],
               'y':[y_vals,y_vals2],
               'color':["firebrick", "navy"],
               'alpha':[0.1, 0.1]}
  
  source = ColumnDataSource(data_dict)
  
  p.multi_line('x','y',source=source,
               color='color', alpha='alpha', line_width=4,
               hover_line_alpha=1.0,hover_line_color='color')
  
  p.add_tools(HoverTool(show_arrow=True,
                        line_policy='nearest',
                        ))
  show(p)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/o5G46.png" rel="noreferrer"><img src="https://i.stack.imgur.com/o5G46.png" alt="hover above top line"></a>
  <a href="https://i.stack.imgur.com/8pmjt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8pmjt.png" alt="hover above bottom line"></a></p>