尝试在python plot.ly 中创建动画雷达图



我正在尝试创建与此处描述的完全相同的雷达图 除了我想用按钮在不同的源数据之间移动时对图表进行动画处理。我一直在尝试实现这里描述的动画机制

我能找到的所有动画示例都只针对笛卡尔坐标。我的代码可以初始化雷达图,但似乎无法开始动画。

(在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)

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

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

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

最新更新