【发布时间】:2021-11-18 08:19:31
【问题描述】:
我想知道,是否有办法重绘已经创建的 PolyCollection。
MWP
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0.0, 2, 0.01)
y = np.sin(2*np.pi*x)
fig, (ax,ax2) = plt.subplots(1,1)
polycolelction = ax.fill_between(x, y)
for i in range(10):
y = 1.2*np.sin(i*np.pi*x)
# here should be data update, probably something like set_offset or set_verts?
polycolelction.set_verts([x,y])
fig.canvas.draw()
fig.canvas.flush_events()
【问题讨论】:
-
这没有回答我的问题,因为该示例中的多边形集合没有重绘,只是每次都创建新的。
标签: python numpy matplotlib