@@ -1297,19 +1297,47 @@ def __init__(self, x, y, dx, dy, *, width=1.0, **kwargs):
12971297 properties.
12981298 """
12991299 super ().__init__ (** kwargs )
1300- self ._patch_transform = (
1301- transforms .Affine2D ()
1302- .scale (np .hypot (dx , dy ), width )
1303- .rotate (np .arctan2 (dy , dx ))
1304- .translate (x , y )
1305- .frozen ())
1300+ self .set_data (x , y , dx , dy , width )
13061301
13071302 def get_path (self ):
13081303 return self ._path
13091304
13101305 def get_patch_transform (self ):
13111306 return self ._patch_transform
13121307
1308+ def set_data (self , x = None , y = None , dx = None , dy = None , width = None ):
1309+ """
1310+ Set `.Arrow` x, y, dx, dy and width.
1311+ Values left as None will not be updated.
1312+
1313+ Parameters
1314+ ----------
1315+ x, y : float or None, default: None
1316+ The x and y coordinates of the arrow base.
1317+
1318+ dx, dy : float or None, default: None
1319+ The length of the arrow along x and y direction.
1320+
1321+ width : float or None, default: None
1322+ Width of full arrow tail.
1323+ """
1324+ if x is not None :
1325+ self ._x = x
1326+ if y is not None :
1327+ self ._y = y
1328+ if dx is not None :
1329+ self ._dx = dx
1330+ if dy is not None :
1331+ self ._dy = dy
1332+ if width is not None :
1333+ self ._width = width
1334+ self ._patch_transform = (
1335+ transforms .Affine2D ()
1336+ .scale (np .hypot (self ._dx , self ._dy ), self ._width )
1337+ .rotate (np .arctan2 (self ._dy , self ._dx ))
1338+ .translate (self ._x , self ._y )
1339+ .frozen ())
1340+
13131341
13141342class FancyArrow (Polygon ):
13151343 """
0 commit comments