小编esv*_*sen的帖子

Python动画雷达图

我正在尝试使用Python / Matplotlib创建雷达图,其中可以使用matplotlib的内置动画模块“回放”测量数据。我希望数据点在遍历数据集时沿各​​自的轴移动。我在读取数据和更新图表时遇到问题,也无法找到一个示例。

我已经附上了一段代码,应该可以使您大致了解我要实现的目标:

import matplotlib.pyplot as plt
import matplotlib.animation as animation
from math import pi


class SubplotAnimation(animation.TimedAnimation):
    def __init__(self, data):

        self.data = data
        fig = plt.figure()
        ax = fig.add_subplot(111, projection='polar')

        # Figure definition
        cat = ['A', 'B', 'C', 'D', 'E']
        values = [10, 10, 10, 10, 10]

        N = len(cat)

        x_as = [n / float(N) * 2 * pi for n in range(N)]

        # Because our chart will be circular we need to append a copy of
        # the …
Run Code Online (Sandbox Code Playgroud)

python animation matplotlib radar-chart

3
推荐指数
1
解决办法
1077
查看次数

标签 统计

animation ×1

matplotlib ×1

python ×1

radar-chart ×1