【问题标题】:Trying to create an animated radar chart in python plot.ly尝试在 python plot.ly 中创建动画雷达图
【发布时间】:2018-06-08 07:15:13
【问题描述】:

我正在尝试以与here 所描述的完全一样的方式创建雷达图 除了我想在图表使用按钮在不同源数据之间移动时为图表设置动画。我一直在尝试实现here

中描述的动画机制

我可以找到的所有动画示例仅适用于笛卡尔坐标。我的代码可以初始化雷达图,但似乎无法开始动画。

(在 Jupyter 上运行以生成可视化!)

非常感谢您的帮助!

from plotly.offline import init_notebook_mode, iplot
from IPython.display import display, HTML

init_notebook_mode(connected=True)

figure = {'data': [{'fill': 'toself',
          'r': [10, 7, 4, 3, 1, 10],
          'theta': ['A','B','C', 'D','E','A'],
          'type': 'scatterpolar',
          'mode': 'markers'}],

      'layout': {'title': 'radar Animation',
           'polar': {'radialaxis': {'range': [0, 10], 'visible': True}},
           'showlegend': False,
           'title': 'Start Title',
                 'updatemenus': [{'type': 'buttons',
                                  'buttons': [{'label': 'Play',
                                               'method': 'animate',
                                               'args': [None]}]}]},

      'frames': [{
        'data': [{'fill': 'toself',
                  'r': [2, 5, 10, 5, 2, 2],
                  'theta': ['A','B','C', 'D','E','A'],
                  'type': 'scatterpolar',
                  'mode': 'markers'}],

        'data': [{'fill': 'toself',
                  'r': [10, 7, 4, 3, 1, 10],
                  'theta': ['A','B','C', 'D','E','A'],
                  'type': 'scatterpolar',
                  'mode': 'markers'}],

        'layout': {'title': 'End Title'}

    },
                  ]}

 iplot(figure)

【问题讨论】:

    标签: python animation plotly radar-chart


    【解决方案1】:

    scatterpolar 跟踪类型当前不支持动画。

    我通过在 plotly.js 存储库 (https://github.com/plotly/plotly.js/search?utf8=%E2%9C%93&q=animatable&type=) 中搜索 animatable 属性确认了这一点。目前只有scattercarpet跟踪类型支持动画。

    随时在 plotly.js 存储库中打开功能请求问题!

    【讨论】:

    • 好的,非常感谢您帮助我验证这一点。我担心这是不可能的,但不知道如何检查。我决定改用 Chart.js。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多