title: How to avoid overlapping text in a plotly scatter plot?
body: <p>I am looking for a solution to avoid overlapping text in the text-labels. I create the image with plotly scatter. Maybe there is an automation here.</p>
  <pre class="lang-py prettyprint-override"><code>from pandas import util
  import plotly.express as px
  import plotly.graph_objects as go
  
  df = util.testing.makeDataFrame()
  df_keyfigures_all = df[['A','B']]
  
  
  
  fig = px.scatter(df_keyfigures_all, x=&quot;A&quot;, y=&quot;B&quot;,size_max=60,
                       text=df_keyfigures_all.index)
  
  fig.update_traces(textposition='top center')
  fig.layout = go.Layout(yaxis=dict(tickformat=&quot;.0%&quot;), xaxis=dict(tickformat=&quot;.0%&quot;),
                         yaxis_title=&quot;A&quot;, xaxis_title=&quot;B&quot;)
  
  
  fig.update_layout(showlegend=False)
  plotly.io.write_image(fig, file='keyfigures.png', format='png')
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Jpvuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jpvuy.png" alt="Points with overlapping labels" /></a></p>