Revision: 7616
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7616&view=rev
Author: ryanmay
Date: 2009-08-31 17:27:12 +0000 (Mon, 31 Aug 2009)
Log Message:
-----------
Update barb_demo.py with an example using masked arrays.
Modified Paths:
--------------
branches/v0_99_maint/examples/pylab_examples/barb_demo.py
Modified: branches/v0_99_maint/examples/pylab_examples/barb_demo.py
===================================================================
--- branches/v0_99_maint/examples/pylab_examples/barb_demo.py 2009-08-31
16:48:46 UTC (rev 7615)
+++ branches/v0_99_maint/examples/pylab_examples/barb_demo.py 2009-08-31
17:27:12 UTC (rev 7616)
@@ -28,7 +28,7 @@
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
+#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))
@@ -39,4 +39,15 @@
barbcolor=['b','g'], barb_increments=dict(half=10, full=20, flag=100),
flip_barb=True)
+#Masked arrays are also supported
+masked_u = np.ma.masked_array(data['u'])
+masked_u[4] = 1000 #Bad value that should not be plotted when masked
+masked_u[4] = np.ma.masked
+
+#Identical plot to panel 2 in the first figure, but with the point at
+#(0.5, 0.25) missing (masked)
+fig2 = plt.figure()
+ax = fig2.add_subplot(1, 1, 1)
+ax.barbs(data['x'], data['y'], masked_u, data['v'], length=8, pivot='middle')
+
plt.show()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins