Matplotlib:动画大数据集

时间:2019-04-01 14:23:13

标签: python matplotlib animation optimization graph

我有XYZ带有20个人体关节的CSV文件,然后需要在XY轴和ZY轴上进行动画处理。我使用pandas从CSV文件和scatter set_offsets

收集数据

我放置的收集数据如

def _update_plot_XY(self, i, fig, scat):
    scat.set_offsets((
        (self.data.HeadX[i], self.data.HeadY[i]),
        (self.data.ShoulderCenterX[i], self.data.ShoulderCenterY[i]),
        (self.data.SpineX[i], self.data.SpineY[i]),
        (self.data.HipCenterX[i], self.data.HipCenterY[i]),
        (self.data.ShoulderLeftX[i], self.data.ShoulderLeftY[i]),
        (self.data.ElbowLeftX[i], self.data.ElbowRightY[i]),
        (self.data.WristRightX[i], self.data.WristRightY[i]), (self.data.HandRightX[i], self.data.HandRightY[i]),
        (self.data.HandLeftX[i], self.data.HandLeftY[i]),
        (self.data.ShoulderRightX[i], self.data.ShoulderRightY[i]),
        (self.data.ElbowRightX[i], self.data.ElbowRightY[i]),
        (self.data.WristLeftX[i], self.data.WristLeftY[i]), (self.data.HipLeftX[i], self.data.HipLeftY[i]),
        (self.data.KneeLeftX[i], self.data.KneeLeftY[i]),
        (self.data.AnkleLeftX[i], self.data.AnkleLeftY[i]),
        (self.data.FootLeftX[i], self.data.FootLeftY[i]), (self.data.HipRightX[i], self.data.HipRightY[i]),
        (self.data.KneeRightX[i], self.data.KneeRightY[i]),
        (self.data.AnkleRightX[i], self.data.AnkleRightY[i]), (self.data.FootRightX[i], self.data.FootRightY[i])))
    return scat

我知道FPS是33

self.anim_XY = animation.FuncAnimation(self.fig, self.human._update_plot_XY, fargs=(self.fig, scat2),
                                             frames=self.human.frames, interval=33, repeat=False)

我尝试在新图中绘制每个图形,但是看起来很糟糕。 还有其他提高FPS的选择吗?

0 个答案:

没有答案