在我的漏斗图中,我想将textinfo注释更改为我客户的语言(中文)。更具体地说,我想将“初始”更改为总体", 和“之前”至上层“。此外,我还想更改内部值的格式,例如将“3000”更改为“3”千“.有什么办法吗?非常感谢!
from plotly import graph_objects as go
fig = go.Figure()
fig.add_trace(go.Funnel(
name = 'Label1',
y = ["stage1", "stage2", "stage3"],
x = [3000, 2000, 1000],
textposition = "inside",
textinfo = "value+percent previous+percent initial"))
fig.add_trace(go.Funnel(
name = 'Label2',
orientation = "h",
y = ["stage1", "stage2", "stage3"],
x = [4000, 2500, 1000],
textposition = "inside",
textinfo = "value+percent previous+percent initial"))
fig.update_layout(legend=dict(
orientation="h",
yanchor="bottom",
y=1.02,
xanchor="right",
x=0.5
)
)
fig.update_traces(textposition='auto', textfont_size=16)
fig.show()s
您可以使用文本模板对其进行自定义。我修改了左侧作为示例
相关问题 更多 >
编程相关推荐