Cleanup animation examples by anntzer · Pull Request #10125 · matplotlib/matplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 18 additions & 43 deletions doc/api/animation_api.rst
4 changes: 2 additions & 2 deletions doc/users/prev_whats_new/whats_new_1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Ryan May has written a backend-independent framework for creating
animated figures. The :mod:`~matplotlib.animation` module is intended
to replace the backend-specific examples formerly in the
:ref:`examples-index` listings. Examples using the new framework are
in :ref:`animation-examples-index`; see the entrancing :ref:`double
pendulum <sphx_glr_gallery_animation_double_pendulum_animated_sgskip.py>` which uses
in :ref:`animation-examples-index`; see the entrancing :file:`double
pendulum <gallery/animation/double_pendulum_sgskip.py>` which uses
:meth:`matplotlib.animation.Animation.save` to create the movie below.

.. raw:: html
Expand Down
5 changes: 3 additions & 2 deletions examples/animation/animate_decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
Decay
=====

A sinusoidal decay animation.
This example showcases:
- using a generator to drive an animation,
- changing axes limits during an animation.
"""


import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
Expand Down
53 changes: 0 additions & 53 deletions examples/animation/basic_example.py

This file was deleted.

54 changes: 0 additions & 54 deletions examples/animation/basic_example_writer_sgskip.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
distribution should converge.
"""

# update a distribution based on new data.
import math

import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as ss
from matplotlib.animation import FuncAnimation


def beta_pdf(x, a, b):
return (x**(a-1) * (1-x)**(b-1) * math.gamma(a + b)
/ (math.gamma(a) * math.gamma(b)))


class UpdateDist(object):
def __init__(self, ax, prob=0.5):
self.success = 0
Expand Down Expand Up @@ -47,7 +52,7 @@ def __call__(self, i):
# Choose success based on exceed a threshold with a uniform pick
if np.random.rand(1,) < self.prob:
self.success += 1
y = ss.beta.pdf(self.x, self.success + 1, (i - self.success) + 1)
y = beta_pdf(self.x, self.success + 1, (i - self.success) + 1)
self.line.set_data(self.x, y)
return self.line,

Expand Down
Loading