但是,我想使用plotly进行漏斗图绘制,但是当我想在框外显示文本时,左侧没有文本,而右侧只有文本。
from plotly import graph_objects as go
stages = ["Homepage visit", "Search page visit",
"Payment Page", "Payment Confirmation"]
fig = go.Figure()
fig.add_trace(go.Funnel(
name = 'Desktop',
y = stages,
x = [30100, 27090, 2860, 150],
textposition = "outside",
textinfo = "value+percent previous"))
fig.add_trace(go.Funnel(
name = 'Mobile',
orientation = "h",
y = stages,
x = [15100, 12080, 2718, 302],
textposition = "outside",
textinfo = "value+percent previous"))
fig.show()
我想查看所有数字。我同时尝试了“内部”和“外部”,但看不到所有数字。
不是,但这是此路径中的内容,请尝试浏览constraintext
和文本格式:
from plotly import graph_objects as go
stages = ["Homepage visit", "Search page visit",
"Payment Page", "Payment Confirmation"]
fig = go.Figure()
fig.add_trace(go.Funnel(
name = 'Desktop',
y = stages,
x = [30100, 27090, 2860, 150],
textposition = "inside",
textinfo = "value+percent previous"
, constraintext='outside'
,textfont=dict(
family="sans serif",
size=14,
color="black"
)
)
)
fig.add_trace(go.Funnel(
name = 'Mobile',
orientation = "h",
y = stages,
x = [15100, 12080, 2718, 302],
textposition = "auto",
textinfo = "value+percent previous"))
fig.show()