Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10018ba

Browse files
committed
Fix bug related to autoscaling and masked values in quiver
svn path=/trunk/matplotlib/; revision=7637
1 parent 25b463c commit 10018ba

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/matplotlib/quiver.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,11 @@ def _make_verts(self, U, V):
498498
a = np.absolute(uv)
499499
if self.scale is None:
500500
sn = max(10, math.sqrt(self.N))
501-
scale = 1.8 * a[~self.Umask].mean() * sn / self.span # crude auto-scaling
501+
if self.Umask is not ma.nomask:
502+
amean = a[~self.Umask].mean()
503+
else:
504+
amean = a.mean()
505+
scale = 1.8 * amean * sn / self.span # crude auto-scaling
502506
self.scale = scale
503507
length = a/(self.scale*self.width)
504508
X, Y = self._h_arrows(length)

0 commit comments

Comments
 (0)