Skip to content

Commit

Permalink
FIX: typos
Browse files Browse the repository at this point in the history
  • Loading branch information
rougier committed May 7, 2014
1 parent 72b7bed commit 2856383
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/animation/rain.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,35 @@
('growth', float, 1),
('color', float, 4)])

# Scatter plot is used to animated rain drops
# Scatter plot is used to animate rain drops
scat = ax.scatter(P['position'][:,0], P['position'][:,1], P['size'], lw=0.5,
animated=True, edgecolors = P['color'], facecolors='None')
ax.set_xlim(0,1), ax.set_xticks([])
ax.set_ylim(0,1), ax.set_yticks([])


def update(frame):
i = frame % 50
i = frame % len(P)

# Make all colors more transparent
P['color'][:,3] = np.maximum(0, P['color'][:,3] - 1.0/len(P))

# Make all circles bigger
P['size'] += P['growth']

# Pick a new position for oldest rain drop
P['position'][i] = np.random.uniform(0,1,2)

# Reset size
P['size'][i] = 5

# Reset color
P['color'][i] = 0,0,0,1

# Choose a random growth factor
P['growth'][i] = np.random.uniform(50,200)

# Update scatter plots
# Update scatter plot
scat.set_edgecolors(P['color'])
scat.set_sizes(P['size'])
scat.set_offsets(P['position'])
Expand Down

0 comments on commit 2856383

Please sign in to comment.