MCPcopy
hub / github.com/matplotlib/matplotlib / quiver

Method quiver

lib/mpl_toolkits/mplot3d/axes3d.py:3483–3608  ·  view source on GitHub ↗

Plot a 3D field of arrows. The arguments can be array-like or scalars, so long as they can be broadcast together. The arguments can also be masked arrays. If an element in any of argument is masked, then that corresponding quiver element will not be plotted.

(self, X, Y, Z, U, V, W, *,
               length=1, arrow_length_ratio=.3, pivot='tail', normalize=False,
               axlim_clip=False, **kwargs)

Source from the content-addressed store, hash-verified

3481
3482 @_preprocess_data()
3483 def quiver(self, X, Y, Z, U, V, W, *,
3484 length=1, arrow_length_ratio=.3, pivot='tail', normalize=False,
3485 axlim_clip=False, **kwargs):
3486 """
3487 Plot a 3D field of arrows.
3488
3489 The arguments can be array-like or scalars, so long as they can be
3490 broadcast together. The arguments can also be masked arrays. If an
3491 element in any of argument is masked, then that corresponding quiver
3492 element will not be plotted.
3493
3494 Parameters
3495 ----------
3496 X, Y, Z : array-like
3497 The x, y and z coordinates of the arrow locations (default is
3498 tail of arrow; see *pivot* kwarg).
3499
3500 U, V, W : array-like
3501 The x, y and z components of the arrow vectors.
3502
3503 length : float, default: 1
3504 The length of each quiver.
3505
3506 arrow_length_ratio : float, default: 0.3
3507 The ratio of the arrow head with respect to the quiver.
3508
3509 pivot : {'tail', 'middle', 'tip'}, default: 'tail'
3510 The part of the arrow that is at the grid point; the arrow
3511 rotates about this point, hence the name *pivot*.
3512
3513 normalize : bool, default: False
3514 Whether all arrows are normalized to have the same length, or keep
3515 the lengths defined by *u*, *v*, and *w*.
3516
3517 axlim_clip : bool, default: False
3518 Whether to hide arrows with points outside the axes view limits.
3519
3520 .. versionadded:: 3.10
3521
3522 data : indexable object, optional
3523 DATA_PARAMETER_PLACEHOLDER
3524
3525 **kwargs
3526 Any additional keyword arguments are delegated to
3527 :class:`.Line3DCollection`
3528 """
3529
3530 def calc_arrows(UVW):
3531 # get unit direction vector perpendicular to (u, v, w)
3532 x = UVW[:, 0]
3533 y = UVW[:, 1]
3534 norm = np.linalg.norm(UVW[:, :2], axis=1)
3535 x_p = np.divide(y, norm, where=norm != 0, out=np.zeros_like(x))
3536 y_p = np.divide(-x, norm, where=norm != 0, out=np.ones_like(x))
3537 # compute the two arrowhead direction unit vectors
3538 rangle = math.radians(15)
3539 c = math.cos(rangle)
3540 s = math.sin(rangle)

Callers 8

errorbarMethod · 0.95
test_quiver3dFunction · 0.45
test_quiver3d_emptyFunction · 0.45
test_quiver3d_maskedFunction · 0.45
test_quiver3d_colorcodedFunction · 0.45
test_axlim_clipFunction · 0.45
test_quiver3D_smokeFunction · 0.45
test_scale3d_artists_logFunction · 0.45

Calls 4

auto_scale_xyzMethod · 0.95
has_dataMethod · 0.80
add_collectionMethod · 0.80
normMethod · 0.45

Tested by 7

test_quiver3dFunction · 0.36
test_quiver3d_emptyFunction · 0.36
test_quiver3d_maskedFunction · 0.36
test_quiver3d_colorcodedFunction · 0.36
test_axlim_clipFunction · 0.36
test_quiver3D_smokeFunction · 0.36
test_scale3d_artists_logFunction · 0.36