I'm creating an animation using Matplotlib and I'm using a Fill object. I'd like to be able to change the fill data from a function. For other plot types there's usually a set_data() function or set_offsets(). Fill doesn't seem to have one. I would expect to do something like the code below but this doesn't work. Any ideas?
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? Did you look up the documentation for that type? I can understand why you would want that code to work, but why do you think it should?triangleis afillobject, which is aPolygon, which I would think would have a way to change it's data.set_xy? matplotlib.org/api/…