0

I'm trying to simulate the interactions between cells on a growth medium. The problem is that I used many arcs to depict the deformed cell membranes so it is difficult to use methods like set_data. Is there a way to plot the frame one by one with an axes instance?

This is what I want:

def anim_func(i, ax, cells):
    ax.clear_all_patches()
    cells.update(i)
    plot_cells(ax, cells)
    return something

cells = Cells(...)
anim = animation.FuncAnimation(fig, anim_func, fargs=(ax, cells), ...)

cells

tctco
  • 45
  • 6
  • What is your problem? Where is your [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)? What hinders you to do it? – Jay Patel Feb 27 '21 at 14:05
  • [Artist.Animation](https://matplotlib.org/3.3.4/api/_as_gen/matplotlib.animation.ArtistAnimation.html) might be useful, then. – Mr. T Feb 27 '21 at 14:26
  • Artist.Animation accumulates what you want to draw. Animation stores what you want to draw and plays it back with the animation function. Animation stores what you want to draw and plays it back in the animation function, so you don't manipulate the data in the animation function. – r-beginners Feb 27 '21 at 14:43
  • I think Artist.Animation should work. However, I'm not familiar with Artist.Animation... The key problem is that there are many artists (arcs, or circles in @r-beginners 's demo). I'm not sure what 'Each list entry is a collection of artists that are made visible on the corresponding frame. Other artists are made invisible' means... – tctco Feb 27 '21 at 14:58
  • As a non-native speaker, I find it difficult to explain it correctly. To explain the code, I have a box with 10 circles and 10 objects in it, and the animation function plays them sequentially. – r-beginners Feb 27 '21 at 15:08
  • I will remove the colaboratory link source, so if you find it helpful, please copy it to your hand. If you comment that you want me to delete it, I will delete my comment. – r-beginners Feb 27 '21 at 15:10
  • I don't think everyone can answer in the current state, so we need to supplement the data and code. – r-beginners Feb 27 '21 at 15:13
  • Artist.Animation should work. Thanks :) – tctco Feb 27 '21 at 15:18
  • I'm glad to hear that. You don't have to give my poor answer. Just self-answer and share. – r-beginners Feb 28 '21 at 02:43

0 Answers0