Revision: 4832
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4832&view=rev
Author:   efiring
Date:     2008-01-09 11:35:54 -0800 (Wed, 09 Jan 2008)

Log Message:
-----------
Streamline quiver by combining X and Y in Nx2 array

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/axes.py
    trunk/matplotlib/lib/matplotlib/quiver.py

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py     2008-01-09 19:08:08 UTC (rev 
4831)
+++ trunk/matplotlib/lib/matplotlib/axes.py     2008-01-09 19:35:54 UTC (rev 
4832)
@@ -1215,7 +1215,7 @@
         if not ma.isMaskedArray(xys):
             xys = npy.asarray(xys)
         self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits)
-       self.ignore_existing_data_limits = False
+        self.ignore_existing_data_limits = False
 
     def update_datalim_numerix(self, x, y):
         'Update the data lim bbox with seq of xy tups'
@@ -1223,8 +1223,8 @@
         # limits and set the bound to be the bounds of the xydata.
         # Otherwise, it will compute the bounds of it's current data
         # and the data in xydata
-       self.dataLim.update_from_data(x, y, self.ignore_existing_data_limits)
-       self.ignore_existing_data_limits = False
+        self.dataLim.update_from_data(x, y, self.ignore_existing_data_limits)
+        self.ignore_existing_data_limits = False
 
     def update_datalim_bounds(self, bounds):
         'Update the datalim to include the given Bbox'
@@ -4388,7 +4388,7 @@
         """
         q = mquiver.Quiver(self, *args, **kw)
         self.add_collection(q, False)
-        self.update_datalim_numerix(q.X, q.Y)
+        self.update_datalim(q.XY)
         self.autoscale_view()
         return q
     quiver.__doc__ = mquiver.Quiver.quiver_doc

Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py   2008-01-09 19:08:08 UTC (rev 
4831)
+++ trunk/matplotlib/lib/matplotlib/quiver.py   2008-01-09 19:35:54 UTC (rev 
4832)
@@ -267,6 +267,7 @@
         X, Y, U, V, C = self._parse_args(*args)
         self.X = X
         self.Y = Y
+        self.XY = npy.hstack((X[:,npy.newaxis], Y[:,npy.newaxis]))
         self.N = len(X)
         self.scale = kw.pop('scale', None)
         self.headwidth = kw.pop('headwidth', 3)
@@ -280,7 +281,7 @@
         self.pivot = kw.pop('pivot', 'tail')
         kw.setdefault('facecolors', self.color)
         kw.setdefault('linewidths', (0,))
-        collections.PolyCollection.__init__(self, [], offsets=zip(X, Y),
+        collections.PolyCollection.__init__(self, [], offsets=self.XY,
                                             transOffset=ax.transData, **kw)
         self.polykw = kw
         self.set_UVC(U, V, C)
@@ -307,7 +308,7 @@
         nr = 1
         if len(nn) > 1:
             nr = nn[1]
-        if len(args) == 2:
+        if len(args) == 2: # remaining after removing U,V,C
             X, Y = [npy.array(a).ravel() for a in args]
             if len(X) == nc and len(Y) == nr:
                 X, Y = [a.ravel() for a in npy.meshgrid(X, Y)]


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to