@@ -3226,24 +3226,24 @@ def __call__(self, path, mutation_size, linewidth,
3226
3226
class _Curve (_Base ):
3227
3227
"""
3228
3228
A simple arrow which will work with any path instance. The
3229
- returned path is simply concatenation of the original path + at
3229
+ returned path is the concatenation of the original path, and at
3230
3230
most two paths representing the arrow head at the begin point and the
3231
3231
at the end point. The arrow heads can be either open or closed.
3232
3232
"""
3233
3233
3234
- def __init__ (self , beginarrow = None , endarrow = None ,
3235
- fillbegin = False , fillend = False ,
3236
- head_length = .2 , head_width = .1 ):
3234
+ beginarrow = endarrow = False # Whether arrows are drawn.
3235
+ fillbegin = fillend = False # Whether arrows are filled.
3236
+
3237
+ def __init__ (self , head_length = .4 , head_width = .2 ):
3237
3238
"""
3238
- The arrows are drawn if *beginarrow* and/or *endarrow* are
3239
- true. *head_length* and *head_width* determines the size
3240
- of the arrow relative to the *mutation scale*. The
3241
- arrowhead at the begin (or end) is closed if fillbegin (or
3242
- fillend) is True.
3239
+ Parameters
3240
+ ----------
3241
+ head_length : float, default: 0.4
3242
+ Length of the arrow head, relative to *mutation_scale*.
3243
+ head_width : float, default: 0.2
3244
+ Width of the arrow head, relative to *mutation_scale*.
3243
3245
"""
3244
- self .beginarrow , self .endarrow = beginarrow , endarrow
3245
3246
self .head_length , self .head_width = head_length , head_width
3246
- self .fillbegin , self .fillend = fillbegin , fillend
3247
3247
super ().__init__ ()
3248
3248
3249
3249
def _get_arrow_wedge (self , x0 , y0 , x1 , y1 ,
@@ -3357,113 +3357,40 @@ def transmute(self, path, mutation_size, linewidth):
3357
3357
class Curve (_Curve ):
3358
3358
"""A simple curve without any arrow head."""
3359
3359
3360
- def __init__ (self ):
3361
- super ().__init__ (beginarrow = False , endarrow = False )
3360
+ def __init__ (self ): # hide head_length, head_width
3361
+ # These attributes (whose values come from backcompat) only matter
3362
+ # if someone modifies beginarrow/etc. on an ArrowStyle instance.
3363
+ super ().__init__ (head_length = .2 , head_width = .1 )
3362
3364
3363
3365
@_register_style (_style_list , name = "<-" )
3364
3366
class CurveA (_Curve ):
3365
3367
"""An arrow with a head at its begin point."""
3366
-
3367
- def __init__ (self , head_length = .4 , head_width = .2 ):
3368
- """
3369
- Parameters
3370
- ----------
3371
- head_length : float, default: 0.4
3372
- Length of the arrow head.
3373
-
3374
- head_width : float, default: 0.2
3375
- Width of the arrow head.
3376
- """
3377
- super ().__init__ (beginarrow = True , endarrow = False ,
3378
- head_length = head_length , head_width = head_width )
3368
+ beginarrow = True
3379
3369
3380
3370
@_register_style (_style_list , name = "->" )
3381
3371
class CurveB (_Curve ):
3382
3372
"""An arrow with a head at its end point."""
3383
-
3384
- def __init__ (self , head_length = .4 , head_width = .2 ):
3385
- """
3386
- Parameters
3387
- ----------
3388
- head_length : float, default: 0.4
3389
- Length of the arrow head.
3390
-
3391
- head_width : float, default: 0.2
3392
- Width of the arrow head.
3393
- """
3394
- super ().__init__ (beginarrow = False , endarrow = True ,
3395
- head_length = head_length , head_width = head_width )
3373
+ endarrow = True
3396
3374
3397
3375
@_register_style (_style_list , name = "<->" )
3398
3376
class CurveAB (_Curve ):
3399
3377
"""An arrow with heads both at the begin and the end point."""
3400
-
3401
- def __init__ (self , head_length = .4 , head_width = .2 ):
3402
- """
3403
- Parameters
3404
- ----------
3405
- head_length : float, default: 0.4
3406
- Length of the arrow head.
3407
-
3408
- head_width : float, default: 0.2
3409
- Width of the arrow head.
3410
- """
3411
- super ().__init__ (beginarrow = True , endarrow = True ,
3412
- head_length = head_length , head_width = head_width )
3378
+ beginarrow = endarrow = True
3413
3379
3414
3380
@_register_style (_style_list , name = "<|-" )
3415
3381
class CurveFilledA (_Curve ):
3416
3382
"""An arrow with filled triangle head at the begin."""
3417
-
3418
- def __init__ (self , head_length = .4 , head_width = .2 ):
3419
- """
3420
- Parameters
3421
- ----------
3422
- head_length : float, default: 0.4
3423
- Length of the arrow head.
3424
-
3425
- head_width : float, default: 0.2
3426
- Width of the arrow head.
3427
- """
3428
- super ().__init__ (beginarrow = True , endarrow = False ,
3429
- fillbegin = True , fillend = False ,
3430
- head_length = head_length , head_width = head_width )
3383
+ beginarrow = fillbegin = True
3431
3384
3432
3385
@_register_style (_style_list , name = "-|>" )
3433
3386
class CurveFilledB (_Curve ):
3434
3387
"""An arrow with filled triangle head at the end."""
3435
-
3436
- def __init__ (self , head_length = .4 , head_width = .2 ):
3437
- """
3438
- Parameters
3439
- ----------
3440
- head_length : float, default: 0.4
3441
- Length of the arrow head.
3442
-
3443
- head_width : float, default: 0.2
3444
- Width of the arrow head.
3445
- """
3446
- super ().__init__ (beginarrow = False , endarrow = True ,
3447
- fillbegin = False , fillend = True ,
3448
- head_length = head_length , head_width = head_width )
3388
+ endarrow = fillend = True
3449
3389
3450
3390
@_register_style (_style_list , name = "<|-|>" )
3451
3391
class CurveFilledAB (_Curve ):
3452
3392
"""An arrow with filled triangle heads at both ends."""
3453
-
3454
- def __init__ (self , head_length = .4 , head_wid
9505
th = .2 ):
3455
- """
3456
- Parameters
3457
- ----------
3458
- head_length : float, default: 0.4
3459
- Length of the arrow head.
3460
-
3461
- head_width : float, default: 0.2
3462
- Width of the arrow head.
3463
- """
3464
- super ().__init__ (beginarrow = True , endarrow = True ,
3465
- fillbegin = True , fillend = True ,
3466
- head_length = head_length , head_width = head_width )
3393
+ beginarrow = endarrow = fillbegin = fillend = True
3467
3394
3468
3395
class _Bracket (_Base ):
3469
3396
0 commit comments