Closed marcoabrate closed 1 year ago
Hi Marco, thanks for raising this, it's actually a known error and will be fixed in the next update (coming soon).
In the meantime, from matplotlib import animation
into your own script as a solution.
Cheers!!
Thanks again, the line from matplotlib import animation
has been added to the relevant modules so this problem is now fixed. I will close this issue
Hi Tom,
Probably because of an update in
matplotlib
, the functionanimate_trajectory
atratinabox/Agent.py
line 557 throws the errorAttributeError: module 'matplotlib' has no attribute 'animation'
.You can replicate the error in
matplotlib
version 3.6.2:The simple workaround is to
import animation
.Full error message
``` --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In [9], line 1 ----> 1 anim = agent.animate_trajectory(speed_up=10) File ~/phd/RatInABox/ratinabox/Agent.py:557, in Agent.animate_trajectory(self, t_start, t_end, speed_up) 554 return 556 fig, ax = self.plot_trajectory(0, 10 * self.dt) --> 557 anim = matplotlib.animation.FuncAnimation( 558 fig, 559 animate, 560 interval=40, 561 frames=int((t_end - t_start) / (40e-3 * speed_up)), 562 blit=False, 563 fargs=(fig, ax, t_start, t_end, speed_up), 564 ) 565 return anim File ~/miniconda3/envs/wp1/lib/python3.9/site-packages/matplotlib/_api/__init__.py:224, in caching_module_getattr.