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.
JavaScript
x
20
20
1
from pandas import util
2
import plotly.express as px
3
import plotly.graph_objects as go
4
5
df = util.testing.makeDataFrame()
6
df_keyfigures_all = df[['A','B']]
7
8
9
10
fig = px.scatter(df_keyfigures_all, x="A", y="B",size_max=60,
11
text=df_keyfigures_all.index)
12
13
fig.update_traces(textposition='top center')
14
fig.layout = go.Layout(yaxis=dict(tickformat=".0%"), xaxis=dict(tickformat=".0%"),
15
yaxis_title="A", xaxis_title="B")
16
17
18
fig.update_layout(showlegend=False)
19
plotly.io.write_image(fig, file='keyfigures.png', format='png')
20
Advertisement
Answer
Unfortunately, there does not seem to be a direct way to do this. A little digging on the plotly community forum will show you that it has already been requested and that the developers are aware of the issue.