首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >plotly中的漏斗图

plotly中的漏斗图
EN

Stack Overflow用户
提问于 2019-07-28 13:03:42
回答 1查看 783关注 0票数 0

我正试着用plotly创建一个漏斗图,但没有任何运气。即使是plotly中的固定例子对我也不起作用,有人能帮我吗?

代码语言:javascript
复制
from plotly import graph_objects as go

fig = go.Figure(go.Funnel(
    y = ["Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"],
    x = [39, 27.4, 20.6, 11, 2]))

fig.show()

我得到了这个巨大的回溯错误:

lueError:接收到的'data‘属性的'plotly.graph_objs.Funnel’类型的值无效:漏斗({ 'x':39,27.4,20.6,11,2,'y':网站访问,下载,潜在客户,请求价格,已发送发票})

代码语言:javascript
复制
The 'data' property is a tuple of trace instances
that may be specified as:
  - A list or tuple of trace instances
    (e.g. [Scatter(...), Bar(...)])
  - A list or tuple of dicts of string/value properties where:
    - The 'type' property specifies the trace type
        One of: ['area', 'bar', 'barpolar', 'box',
                 'candlestick', 'carpet', 'choropleth', 'cone',
                 'contour', 'contourcarpet', 'funnel',
                 'funnelarea', 'heatmap', 'heatmapgl',
                 'histogram', 'histogram2d',
                 'histogram2dcontour', 'isosurface', 'mesh3d',
                 'ohlc', 'parcats', 'parcoords', 'pie',
                 'pointcloud', 'sankey', 'scatter',
                 'scatter3d', 'scattercarpet', 'scattergeo',
                 'scattergl', 'scattermapbox', 'scatterpolar',
                 'scatterpolargl', 'scatterternary', 'splom',
                 'streamtube', 'sunburst', 'surface', 'table',
                 'violin', 'volume', 'waterfall']

    - All remaining properties are passed to the constructor of
      the specified trace type

    (e.g. [{'type': 'scatter', ...}, {'type': 'bar, ...}])
EN

回答 1

Stack Overflow用户

发布于 2019-07-28 21:14:21

看起来您正在使用版本3,在这种情况下,您将需要使用go.Figure(data=[go.Funnel(...)]) (基本上将漏斗跟踪包装在一个数组中……只有在版本4中才是可选的)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57238109

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档