Revision: 5827
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5827&view=rev
Author:   ryanmay
Date:     2008-07-24 02:28:20 +0000 (Thu, 24 Jul 2008)

Log Message:
-----------
Update barb_demo.py to exercise more of the possible parameters for wind barb 
plots. Replace some confusing code for passing in the data with more explicit 
arrays.  Also, make the data array for the arbitrary grid non-square so that 
proper dimensioning can be seen.  Remove mysterious windows-styles line endings.

Modified Paths:
--------------
    trunk/matplotlib/examples/pylab_examples/barb_demo.py

Modified: trunk/matplotlib/examples/pylab_examples/barb_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/barb_demo.py       2008-07-24 
02:02:01 UTC (rev 5826)
+++ trunk/matplotlib/examples/pylab_examples/barb_demo.py       2008-07-24 
02:28:20 UTC (rev 5827)
@@ -3,31 +3,39 @@
 '''
 import matplotlib.pyplot as plt
 import numpy as np
-
-x = np.linspace(-5, 5, 5)
-X,Y = np.meshgrid(x, x)
-U, V = 12*X, 12*Y
-
-data = [(-1.5,.5,-6,-6),
-        (1,-1,-46,46),
-        (-3,-1,11,-11),
-        (1,1.5,80,80)]
-
-#Default parameters for arbitrary set of vectors
-ax = plt.subplot(2,2,1)
-ax.barbs(*zip(*data))
-
-#Default parameters, uniform grid
-ax = plt.subplot(2,2,2)
-ax.barbs(X, Y, U, V)
-
-#Change parameters for arbitrary set of vectors
-ax = plt.subplot(2,2,3)
-ax.barbs(flagcolor='r', barbcolor=['b','g'], barb_increments=dict(half=10,
-    full=20, flag=100), *zip(*data))
-
-#Showing colormapping with uniform grid. 
-ax = plt.subplot(2,2,4)
-ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False)
 
+x = np.linspace(-5, 5, 5)
+X,Y = np.meshgrid(x, x)
+U, V = 12*X, 12*Y
+
+data = [(-1.5, .5, -6, -6),
+        (1, -1, -46, 46),
+        (-3, -1, 11, -11),
+        (1, 1.5, 80, 80),
+        (0.5, 0.25, 25, 15),
+        (-1.5, -0.5, -5, 40)]
+
+data = np.array(data, dtype=[('x', np.float32), ('y', np.float32),
+    ('u', np.float32), ('v', np.float32)])
+
+#Default parameters, uniform grid
+ax = plt.subplot(2,2,1)
+ax.barbs(X, Y, U, V)
+
+#Arbitrary set of vectors, make them longer and change the pivot point
+#(point around which they're rotated) to be the middle
+ax = plt.subplot(2,2,2)
+ax.barbs(data['x'], data['y'], data['u'], data['v'], length=8, pivot='middle')
+
+#Showing colormapping with uniform grid.  Fill the circle for an empty barb,
+#don't round the values, and change some of the size parameters 
+ax = plt.subplot(2,2,3)
+ax.barbs(X, Y, U, V, np.sqrt(U*U + V*V), fill_empty=True, rounding=False,
+    sizes=dict(emptybarb=0.25, spacing=0.2, height=0.3))
+
+#Change colors as well as the increments for parts of the barbs
+ax = plt.subplot(2,2,4)
+ax.barbs(data['x'], data['y'], data['u'], data['v'], flagcolor='r',
+    barbcolor=['b','g'], barb_increments=dict(half=10, full=20, flag=100))
+
 plt.show()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to