title: Hover data on bar graph without plotting text - plotly
body: <p>I am struggling with something that is probably quite simple.<br>
  consider this: I have unit ids with data for each unit id.<br>
  I want to construct a bar graph and to be able to select whatever unit id I want.<br>
  To do this I chose plotly px. I am constructing the bars according to some range split method (using pd.cut)<br>
  The result I have is very close to what I want. <br>
  when I’m hovering on the different units on the graph I see the unit id, range, and exact value
  but the text is also plotted on the graph and makes the plot very messy.<br>
  I tried to use different px.bar attributed to replacing %{text}% but without success.</p>
  <p>Small code that reproduces the plot I have</p>
  <pre><code>import dash_core_components as dcc
  import numpy as np
  import pandas as pd
  import dash
  import dash_html_components as html
  import plotly.express as px
  
  data = np.random.rand(300)
  unit_id = np.random.choice(range(1000), 300, replace=False)
  data_tuple = sorted([(str(uid), data) for uid, data in zip(unit_id, data)], key=lambda x: x[1])
  
  y_data = [y[1] for y in data_tuple]
  x_data = [i for i in range(1, len(y_data) + 1)]
  range_bins = pd.cut(np.array(np.array(y_data).astype(float)), 10)
  data_range_lbl = [str(v) for v in range_bins]
  
  sorted_unit_id = [x[0] for x in data_tuple]
  unit_id_text = [sorted_unit_id[i] + '&lt;br&gt;&lt;b&gt;Value&lt;/b&gt;: ' + str(y_data[i]) for i in range(0, len(sorted_unit_id))]
  fig = px.bar(x=data_range_lbl, y=[1 for i in range(0, len(data_range_lbl))], text=unit_id_text)
  
  fig.update_layout(dragmode='select')
  fig.update_traces(hovertemplate=
                    '&lt;b&gt;Die Id&lt;/b&gt;: %{text}' +
                    '&lt;br&gt;&lt;b&gt;Range&lt;/b&gt;: %{x}&lt;br&gt;')
  app = dash.Dash(__name__)
  app.layout = html.Div([
      html.Div(id='container-button-timestamp'),
      dcc.Graph(
          id='sample-graph', figure=fig
      ),
  ])
  
  if __name__ == '__main__':
      app.run_server(debug=True, port=8050)
  </code></pre>
  <p>how it looks:
  <a href="https://i.stack.imgur.com/x0rgC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x0rgC.png" alt="enter image description here" /></a></p>