2828@_api .define_aliases ({
2929 "antialiased" : ["aa" ],
3030 "edgecolor" : ["ec" ],
31- "facecolor " : ["fc" ],
31+ "fac color " : ["fc" ],
3232 "linestyle" : ["ls" ],
3333 "linewidth" : ["lw" ],
3434})
@@ -2372,14 +2372,18 @@ def __call__(self, x0, y0, width, height, mutation_size):
23722372 class LArrow :
23732373 """A box in the shape of a left-pointing arrow."""
23742374
2375- def __init__ (self , pad = 0.3 ):
2375+ def __init__ (self , pad = 0.3 , fhead = False ):
23762376 """
23772377 Parameters
23782378 ----------
23792379 pad : float, default: 0.3
23802380 The amount of padding around the original box.
2381+
2382+ fhead : bool, default: False
2383+ If the arrowheads should be flush with the top and botton sides of the arrow body.
23812384 """
23822385 self .pad = pad
2386+ self .fhead = fhead
23832387
23842388 def __call__ (self , x0 , y0 , width , height , mutation_size ):
23852389 # padding
@@ -2394,11 +2398,14 @@ def __call__(self, x0, y0, width, height, mutation_size):
23942398 dxx = dx / 2
23952399 x0 = x0 + pad / 1.4 # adjust by ~sqrt(2)
23962400
2397- return Path ._create_closed (
2398- [(x0 + dxx , y0 ), (x1 , y0 ), (x1 , y1 ), (x0 + dxx , y1 ),
2399- (x0 + dxx , y1 + dxx ), (x0 - dx , y0 + dx ),
2400- (x0 + dxx , y0 - dxx ), # arrow
2401- (x0 + dxx , y0 )])
2401+ if self .fhead :
2402+ return Path ._create_closed ([(x0 + dxx - pad , y0 ), (x1 , y0 ), (x1 , y1 ), (x0 + dxx - pad , y1 ),
2403+ (x0 - dx - pad , y0 + dx ), (x0 + dxx - pad , y0 )])
2404+
2405+ return Path ._create_closed ([(x0 + dxx , y0 ), (x1 , y0 ), (x1 , y1 ), (x0 + dxx , y1 ),
2406+ (x0 + dxx , y1 + dxx ), (x0 - dx , y0 + dx ),
2407+ (x0 + dxx , y0 - dxx ), # arrow
2408+ (x0 + dxx , y0 ), (x0 + dxx , y0 )])
24022409
24032410 @_register_style (_style_list )
24042411 class RArrow (LArrow ):
@@ -2415,14 +2422,18 @@ class DArrow:
24152422 """A box in the shape of a two-way arrow."""
24162423 # Modified from LArrow to add a right arrow to the bbox.
24172424
2418- def __init__ (self , pad = 0.3 ):
2425+ def __init__ (self , pad = 0.3 , fhead = False ):
24192426 """
24202427 Parameters
24212428 ----------
24222429 pad : float, default: 0.3
24232430 The amount of padding around the original box.
2431+
2432+ fhead : bool, default: False
2433+ If the arrowheads should be flush with the top and botton sides of the arrow body.
24242434 """
24252435 self .pad = pad
2436+ self .fhead = fhead
24262437
24272438 def __call__ (self , x0 , y0 , width , height , mutation_size ):
24282439 # padding
@@ -2438,14 +2449,20 @@ def __call__(self, x0, y0, width, height, mutation_size):
24382449 dxx = dx / 2
24392450 x0 = x0 + pad / 1.4 # adjust by ~sqrt(2)
24402451
2441- return Path ._create_closed ([
2442- (x0 + dxx , y0 ), (x1 , y0 ), # bot-segment
2443- (x1 , y0 - dxx ), (x1 + dx + dxx , y0 + dx ),
2444- (x1 , y1 + dxx ), # right-arrow
2445- (x1 , y1 ), (x0 + dxx , y1 ), # top-segment
2446- (x0 + dxx , y1 + dxx ), (x0 - dx , y0 + dx ),
2447- (x0 + dxx , y0 - dxx ), # left-arrow
2448- (x0 + dxx , y0 )])
2452+ if self .fhead :
2453+ return Path ._create_closed ([(x0 + dxx - pad , y0 ), (x1 + pad , y0 ),
2454+ (x1 + dx + dxx + pad , y0 + dx ),
2455+ (x1 + pad , y1 ), (x0 + dxx - pad , y1 ),
2456+ (x0 - dx - pad , y0 + dx ),
2457+ (x0 + dxx - pad , y0 )])
2458+
2459+ return Path ._create_closed ([(x0 + dxx , y0 ), (x1 , y0 ), # bot-segment
2460+ (x1 , y0 - dxx ), (x1 + dx + dxx , y0 + dx ),
2461+ (x1 , y1 + dxx ), # right-arrow
2462+ (x1 , y1 ), (x0 + dxx , y1 ), # top-segment
2463+ (x0 + dxx , y1 + dxx ), (x0 - dx , y0 + dx ),
2464+ (x0 + dxx , y0 - dxx ), # left-arrow
2465+ (x0 + dxx , y0 )])
24492466
24502467 @_register_style (_style_list )
24512468 class Round :
0 commit comments