【发布时间】: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