@@ -4057,6 +4057,53 @@ def stem(self, x, y, z, *, linefmt='C0-', markerfmt='C0o', basefmt='C3-',
4057
4057
4058
4058
stem3D = stem
4059
4059
4060
+ @_preprocess_data ()
4061
+ def arrow3d (self , end , start = None , ** kwargs ):
4062
+ """
4063
+ 3D plot of a single arrow
4064
+
4065
+ Parameters
4066
+ ----------
4067
+ end : 1D array
4068
+ an array of shape (3,).
4069
+
4070
+ start : 1D array, default: (0,0,0)
4071
+ an array of shape (3,).
4072
+
4073
+ data : indexable object, optional
4074
+ DATA_PARAMETER_PLACEHOLDER
4075
+
4076
+ **kwargs
4077
+ All other keyword arguments are passed on to
4078
+ `~mpl_toolkits.mplot3d.art3d.Arrow3D`.
4079
+
4080
+ Returns
4081
+ -------
4082
+ arrow : `~mpl_toolkits.mplot3d.art3d.Arrow3D`
4083
+
4084
+ """
4085
+ had_data = self .has_data ()
4086
+
4087
+ if start is None :
4088
+ start = np .zeros_like (end )
4089
+ if np .shape (end ) != (3 ,):
4090
+ raise ValueError ("end must be an array of length 3" )
4091
+ if np .shape (start ) != (3 ,):
4092
+ raise ValueError ("start must be an array of length 3" )
4093
+
4094
+ # Set default arrow properties and update with any additional keyword args
4095
+ arrow_props = dict (
4096
+ mutation_scale = 20 , arrowstyle = "-|>" , shrinkA = 0 , shrinkB = 0
4097
+ )
4098
+ arrow_props .update (kwargs )
4099
+
4100
+ arrow = art3d .Arrow3D (start , end , ** arrow_props )
4101
+ self .add_artist (arrow )
4102
+ xs , ys , zs = list (zip (start , end ))
4103
+ self .auto_scale_xyz (xs , ys , zs , had_data )
4104
+
4105
+ return arrow
4106
+
4060
4107
4061
4108
def get_test_data (delta = 0.05 ):
4062
4109
"""Return a tuple X, Y, Z with a test data set."""
0 commit comments