From 2856383b152a50eae2af1f0d6e75a727706474e5 Mon Sep 17 00:00:00 2001 From: Nicolas Rougier Date: Wed, 7 May 2014 18:19:03 +0200 Subject: [PATCH] FIX: typos --- examples/animation/rain.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/animation/rain.py b/examples/animation/rain.py index ddda6b8f5422..5bef1079738f 100644 --- a/examples/animation/rain.py +++ b/examples/animation/rain.py @@ -21,7 +21,7 @@ ('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([]) @@ -29,23 +29,27 @@ 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'])