Reputation: 1241
In my funnel plot, I want to change textinfo annotation to my client's language(Chinese).To be more specific, I want to change "initial" to "总体", and "previous" to "上层". Also, I want to change the format of inside values too, e.g. "3000" to "3千". Is there any method to do it? Thanks a lot!
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
Upvotes: 0
Views: 3138
Reputation: 35230
You can customize it by using text templates. I modified the left side as a sample.
fig.add_trace(go.Funnel(
name = 'Label1',
y = \["stage1", "stage2", "stage3"\],
x = \[3000, 2000, 1000\],
textposition = "inside",
textinfo = "value+percent previous+percent initial",
texttemplate='%{value}<br>%{percentInitial}总体<br>%{percentPrevious}上层'
))
Upvotes: 2