8000 Removed normalization of arrows in 3D quiver · matplotlib/matplotlib@a204ae0 · GitHub
[go: up one dir, main page]

Skip to content

Commit a204ae0

Browse files
committed
Removed normalization of arrows in 3D quiver
I removed the normalization of the arrows in 3D quiver to match the behavior of the 2D quiver plot. Also, I changed the default pivot point to be ‘tail’ in order to match the 2D quiver plot. Also, clarified the comment about normalizing the ‘uvw’ variable.
1 parent 838502e commit a204ae0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,7 @@ def quiver(self, *args, **kwargs):
24772477
24782478
*X*, *Y*, *Z*:
24792479
The x, y and z coordinates of the arrow locations (default is
2480-
tip of arrow; see *pivot* kwarg)
2480+
tail of arrow; see *pivot* kwarg)
24812481
24822482
*U*, *V*, *W*:
24832483
The x, y and z components of the arrow vectors
@@ -2499,7 +2499,8 @@ def quiver(self, *args, **kwargs):
24992499
25002500
*pivot*: [ 'tail' | 'middle' | 'tip' ]
25012501
The part of the arrow that is at the grid point; the arrow
2502-
rotates about this point, hence the name *pivot*.
2502+
rotates about this point, hence the name *pivot*.
2503+
Default is 'tail'
25032504
25042505
Any additional keyword arguments are delegated to
25052506
:class:`~matplotlib.collections.LineCollection`
@@ -2508,6 +2509,7 @@ def quiver(self, *args, **kwargs):
25082509
def calc_arrow(uvw, angle=15):
25092510
"""
25102511
To calculate the arrow head. uvw should be a unit vector.
2512+
We normalize it here:
25112513
"""
25122514
# get unit direction vector perpendicular to (u,v,w)
25132515
norm = np.linalg.norm(uvw[:2])
@@ -2540,7 +2542,7 @@ def calc_arrow(uvw, angle=15):
25402542
# arrow length ratio to the shaft length
25412543
arrow_length_ratio = kwargs.pop('arrow_length_ratio', 0.3)
25422544
# pivot point
2543-
pivot = kwargs.pop('pivot', 'tip')
2545+
pivot = kwargs.pop('pivot', 'tail')
25442546

25452547
# handle args
25462548
argi = 6
@@ -2601,7 +2603,7 @@ def calc_arrow(uvw, angle=15):
26012603
# If any row of UVW is all zeros, don't make a quiver for it
26022604
mask = norm > 1e-10
26032605
XYZ = XYZ[mask]
2604-
UVW = UVW[mask] / norm[mask].reshape((-1, 1))
2606+
UVW = UVW[mask]
26052607

26062608
if len(XYZ) > 0:
26072609
# compute the shaft lines all at once with an outer product

0 commit comments

Comments
 (0)
0