@@ -4057,6 +4057,50 @@ 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
+ **kwargs
4074
+ All other keyword arguments are passed on to
4075
+ `~mpl_toolkits.mplot3d.art3d.Arrow3D`.
4076
+
4077
+ Returns
4078
+ -------
4079
+ arrow : `~mpl_toolkits.mplot3d.art3d.Arrow3D`
4080
+
4081
+ """
4082
+ had_data = self .has_data ()
4083
+
4084
+ if start is None :
4085
+ start = np .zeros_like (end )
4086
+ if np .shape (end ) != (3 ,):
4087
+ raise ValueError ("end must be an array of length 3" )
4088
+ if np .shape (start ) != (3 ,):
4089
+ raise ValueError ("start must be an array of length 3" )
4090
+
4091
+ # Set default arrow properties and update with any additional keyword args
4092
+ arrow_props = dict (
4093
+ mutation_scale = 20 , arrowstyle = "-|>" , shrinkA = 0 , shrinkB = 0
4094
+ )
4095
+ arrow_props .update (kwargs )
4096
+
4097
+ xs , ys , zs = [start [0 ], end [0 ]], [start [1 ], end [1 ]], [start [2 ], end [2 ]]
4098
+ arrow = art3d .Arrow3D (xs , ys , zs , ** arrow_props )
4099
+ self .add_artist (arrow )
4100
+ self .auto_scale_xyz (xs , ys , zs , had_data )
4101
+
4102
+ return arrow
4103
+
4060
4104
4061
4105
def get_test_data (delta = 0.05 ):
4062
4106
"""Return a tuple X, Y, Z with a test data set."""
0 commit comments