【发布时间】:2021-07-14 01:18:42
【问题描述】:
我正在寻找一种解决方案来避免文本标签中的文本重叠。我用散点图创建图像。也许这里有自动化。
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="A", y="B",size_max=60,
text=df_keyfigures_all.index)
fig.update_traces(textposition='top center')
fig.layout = go.Layout(yaxis=dict(tickformat=".0%"), xaxis=dict(tickformat=".0%"),
yaxis_title="A", xaxis_title="B")
fig.update_layout(showlegend=False)
plotly.io.write_image(fig, file='keyfigures.png', format='png')
感谢您的帮助!
【问题讨论】:
标签: python plotly scatter-plot