|
From: <ry...@us...> - 2010-04-02 18:47:06
|
Revision: 8217
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8217&view=rev
Author: ryanmay
Date: 2010-04-02 18:47:00 +0000 (Fri, 02 Apr 2010)
Log Message:
-----------
Correct calculation of vectors with quiver and angles='xy'. Using just a small eps can result in roundoff problems if X,Y are large (such as with Basemap).
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2010-04-01 03:41:24 UTC (rev 8216)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2010-04-02 18:47:00 UTC (rev 8217)
@@ -537,10 +537,11 @@
# points, regardless of the axis scaling (including log).
angles, lengths = self._angles_lengths(U, V, eps=1)
elif self.angles == 'xy' or self.scale_units == 'xy':
- # We could refine this by calculating eps based on
- # the magnitude of U, V relative to that of X, Y,
- # to ensure we are always making small shifts in X, Y.
- angles, lengths = self._angles_lengths(U, V, eps=0.001)
+ # Calculate eps based on the extents of the plot
+ # so that we don't end up with roundoff error from
+ # adding a small number to a large.
+ angles, lengths = self._angles_lengths(U, V,
+ eps=np.abs(self.ax.dataLim.extents).max() * 0.001)
if self.scale_units == 'xy':
a = lengths
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|