我正在尝试使用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)