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