你好,我正在尝试从数据框中制作一个箭头图的动画。
我在Pandas DataFrame中存储了如下数据:
QuivXLoc QuivYLoc QuivXVal QuivYVal QuivColorVal QuivPlotNum
0 -70.22 -127.241 1.624 -0.879 1.846623 1
1 -61.74 -127.241 -0.973 -0.027 0.973375 1
2 -65.98 -121.835 0.046 2.416 2.416438 1
3 -74.46 -121.835 -0.151 2.673 2.677262 1
4 -78.70 -116.429 1.073 -0.954 1.435773 2
我目前是这样绘制它的,它可以完美地生成每个序列号的单独图表。
for seq in quidf['QuivPlotNum'].unique():
temp=quidf[quidf['QuivPlotNum']==seq] ## make subset to plot
plt.quiver(temp['QuivXLoc'], temp['QuivYLoc'], temp['QuivXVal'], temp['QuivYVal'], # data
temp['QuivColorVal'], # colour the arrows based on this array
cmap=cm.jet, # colour map
headlength=3) # length of the arrows
这里有一些格式化图表的附加代码我没有列出。
我想做的是基于迭代我的数据框中的序列数字来对序列进行动画化。我看到的所有Quiver动画示例都涉及通过增加某个标量来缩放先前的函数。
我想生成类似quiver动画的示例,但我尝试了很多次,无法弄清楚如何更改update_quiver使其适用于我的应用程序: 在Python中绘制动态箭头