matplotlib-animation

Unable to save animated plots in Python: missing propositional argument 'self'

Unable to save animated plots in Python: missing propositional argument 'self' Question: I am writing a Python code in Spyder that produces an animated 2D scatter plot but I encounter a TypeError when I try to save it. I use the following: matplotlib.animation.Animation(‘fig.mp4’) where fig.mp4 is an example filename. When I run the code everything …

Total answers: 1

Animate labels using FuncAnimation in Matplotlib

Animate labels using FuncAnimation in Matplotlib Question: I am not able to make (animated) labels using FuncAnimation from matplotlib. Please find below a minimal code that I made. ax.annotate has no effect at all – the animation itself works though. What can I change to get animated labels/titles, which are different for each frame? import …

Total answers: 1

Removing duplicates from animation's lened of a 3d plot in python

Removing duplicates from animation's lened of a 3d plot in python Question: I am exporting an animation in python but the legend is repeating. I have only one plot and want to have one single legend item in every frame of the animation. This is my script: import numpy as np import matplotlib.pyplot as plt …

Total answers: 3

How to move a patch along a path?

How to move a patch along a path? Question: I am trying to animate a patch.Rectangle object using matplotlib. I want the said object to move along a path.Arc. A roundabout way to do this would be (approximately) : import numpy as np from matplotlib import pyplot as plt from matplotlib import animation import matplotlib.patches …

Total answers: 3

Unable to refresh plt.axhline() in matplotlib

Unable to refresh plt.axhline() in matplotlib Question: I’m just trying to make a live graph using matplotlib.However I couldn’t find a way to draw-remove-redraw axhline(). My aim is to show a horizontal line of newest value of Y axis values and of course remove the recent horizontal line. ` import matplotlib.pyplot as plt import matplotlib.animation …

Total answers: 1

Combining a text update with n curves being updated using matplotlib animation

Combining a text update with n curves being updated using matplotlib animation Question: I have n curves that I draw using matplotlib’s animation. Thanks to a previous question and the answer to it, this works well. Now I want to add some text in the plot which is continuously updated, basically the frame number, but …

Total answers: 1

How to animate n curves in a plot using matplotlib's animation?

How to animate n curves in a plot using matplotlib's animation? Question: I have n curves that I want to draw using matplotlib’s animation (each curve corresponds to a gpx file recorded with a fitness tracker or a smartphone). It works well when using only one track or two tracks. But as soon as I …

Total answers: 1

Matplotlib animation not displaying correctly in Colab

Matplotlib animation not displaying correctly in Colab Question: I know there are previous answers to this question but for some reason I cannot seem to get the animation to show. Instead all the frames of the animation are overlayed in a figure that appears below the blank animation from matplotlib import animation import matplotlib.pyplot as …

Total answers: 2

How do you smoothen matplotlib animations?

How do you smoothen matplotlib animations? Question: I’m relatively new to programming, and I’ve tried using matplotlib’s animation library to, quite obviously, animate. However, the animation I produce is really slow and discontinuous. The following code is an example of this, it does, however, involve a relatively large number of computations. random_set is just a …

Total answers: 1