8000 Restore reset to Bayes animation example. · matplotlib/matplotlib@80bac99 · GitHub
[go: up one dir, main page]

Skip to content

Commit 80bac99

Browse files
committed
Restore reset to Bayes animation example.
Once the animation rolls around, it has iteration count < success count, which is nonsensical, and produces math domain errors.
1 parent 5f555f8 commit 80bac99

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/animation/bayes_update.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def __init__(self, ax, prob=0.5):
4141
def __call__(self, i):
4242
# This way the plot can continuously run and we just keep
4343
# watching new realizations of the process
44+
if i == 0:
45+
self.success = 0
46+
self.line.set_data([], [])
47+
return self.line,
4448

4549
# Choose success based on exceed a threshold with a uniform pick
4650
if np.random.rand(1,) < self.prob:

0 commit comments

Comments
 (0)
0