我正在使用Matplotlib创建动画,并使用Fill对象。我想能够从一个函数中更改填充数据。对于其他类型的绘图,通常有set_data()
函数或set_offsets()
函数。但是Fill似乎没有这样的函数。我希望能够像下面的代码一样实现,但这不起作用。有什么想法吗?
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.axes(xlim=(-1, 1), ylim=(-1, 1),)
triangle, = ax.fill([0,1,1],[0,0,1])
# I want to change the datapoints later in my code, like this:
triangle.set_data([0,2,2],[0,0,2])
triangle
是什么类型的对象?你查阅了该类型的文档吗?我能理解你为什么希望那段代码能够工作,但你认为它应该工作的原因是什么? - tacaswellset_xy
是什么?请参考http://matplotlib.org/api/artist_api.html#matplotlib.patches.Polygon.set_xy - tacaswell