Skip to content

Fixed AttributeError bug on animation/random_walk.py example and added description #13779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 5 additions & 2 deletions examples/animation/random_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
Animated 3D random walk
=======================

This generates 50 lines using random walk
and animates their creation in a 3D space
"""

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D

# Fixing random state for reproducibility
np.random.seed(19680801)
np.random.seed(20160425)


def gen_rand_line(length, dims=2):
Expand Down Expand Up @@ -42,7 +45,7 @@ def update_lines(num, dataLines, lines):

# Attaching 3D axis to the figure
fig = plt.figure()
ax = fig.add_subplot(projection="3d")
ax = fig.add_subplot(111, projection="3d")

# Fifty lines of random 3-D lines
data = [gen_rand_line(25, 3) for index in range(50)]
Expand Down