簡體   English   中英

如何以 plotly 顯示漏斗圖中的所有數字?

[英]How to show all the numbers in funnel plot in plotly?

我正在使用 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()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM