Problem matplotlib animation
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- jupyter-notebook, python
- Domaine
- data-visualization
Piste de recherche
Commencez par exécuter le code du notebook fourni avec %matplotlib widget et comparez-le au même code sous forme de script. Étudiez pourquoi repeat=False est ignoré et vérifiez que l’animation s’arrête après les 200 images demandées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Dear all,
I have tried to make an animation with jupyter-matplotlib. It has worked, but despite the repeat=False flag it just repeats forever. The example is taken from a tutorial. This does not happen if I just use the code as a script.
%matplotlib widget
"""
Matplotlib Animation Example
author: Jake Vanderplas
email: [email protected]
website: http://jakevdp.github.com
license: BSD
Please feel free to use and modify this, but keep the above information. Thanks!
"""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
# First set up the figure, the axis, and the plot element we want to animate
fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
line, = ax.plot([], [], lw=2)
# initialization function: plot the background of each frame
def init():
line.set_data([], [])
return line,
# animation function. This is called sequentially
def animate(i):
x = np.linspace(0, 2, 1000)
y = np.sin(2 * np.pi * (x - 0.01 * i))
line.set_data(x, y)
ax.set_title(str(i))
return line,
# call the animator. blit=True means only re-draw the parts that have changed.
anim = animation.FuncAnimation(fig, animate, init_func=init,
frames=200, interval=20, blit=True,repeat=False)
# save the animation as an mp4. This requires ffmpeg or mencoder to be
# installed. The extra_args ensure that the x264 codec is used, so that
# the video can be embedded in html5. You may need to adjust this for
# your system: for more information, see
# http://matplotlib.sourceforge.net/api/animation_api.html
anim.save('basic_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])
plt.show()
Thanks a lot!
Sergio
- Langage dominant
- Jupyter Notebook
- Étoiles
- 1.7k
- Forks
- 234
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de matplotlib/ipympl
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
matplotlib/ipympl#623 · 1 commentaire ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
matplotlib/ipympl#622 · 13 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
matplotlib/ipympl#612 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
matplotlib/ipympl#611 · 4 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
matplotlib/ipympl#609 · 7 commentaires ·
Toutes les issues de matplotlib/ipympl
Issues similaires
-
feat: Support mattomoOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
openfoodfacts/nutripatrol-frontend#306 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
Youth-Research-Center/PandaPlot#468 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
python-visualization/folium#2293 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour