Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44fff05

Browse files
committed
Shorten bracket arrowstyle docs.
We can still support None angles as synonym to zero, but don't really need to document them.
1 parent d45060c commit 44fff05

1 file changed

Lines changed: 20 additions & 48 deletions

File tree

lib/matplotlib/patches.py

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,7 @@ class _Bracket(_Base):
32153215
def __init__(self, bracketA=None, bracketB=None,
32163216
widthA=1., widthB=1.,
32173217
lengthA=0.2, lengthB=0.2,
3218-
angleA=None, angleB=None,
3218+
angleA=0, angleB=0,
32193219
scaleA=None, scaleB=None):
32203220
self.bracketA, self.bracketB = bracketA, bracketB
32213221
self.widthA, self.widthB = widthA, widthB
@@ -3241,7 +3241,7 @@ def _get_bracket(self, x0, y0,
32413241
Path.LINETO,
32423242
Path.LINETO]
32433243

3244-
if angle is not None:
3244+
if angle:
32453245
trans = transforms.Affine2D().rotate_deg_around(x0, y0, angle)
32463246
vertices_arrow = trans.transform(vertices_arrow)
32473247

@@ -3298,32 +3298,18 @@ class BracketAB(_Bracket):
32983298
"""An arrow with outward square brackets at both ends."""
32993299

33003300
def __init__(self,
3301-
widthA=1., lengthA=0.2, angleA=None,
3302-
widthB=1., lengthB=0.2, angleB=None):
3301+
widthA=1., lengthA=0.2, angleA=0,
3302+
widthB=1., lengthB=0.2, angleB=0):
33033303
"""
33043304
Parameters
33053305
----------
3306-
widthA : float, default: 1.0
3306+
widthA, widthB : float, default: 1.0
33073307
Width of the bracket.
3308-
3309-
lengthA : float, default: 0.2
3308+
lengthA, lengthB : float, default: 0.2
33103309
Length of the bracket.
3311-
3312-
angleA : float, default: None
3313-
Angle, in degrees, between the bracket and the line. Zero is
3314-
perpendicular to the line, and positive measures
3315-
counterclockwise.
3316-
3317-
widthB : float, default: 1.0
3318-
Width of the bracket.
3319-
3320-
lengthB : float, default: 0.2
3321-
Length of the bracket.
3322-
3323-
angleB : float, default: None
3324-
Angle, in degrees, between the bracket and the line. Zero is
3325-
perpendicular to the line, and positive measures
3326-
counterclockwise.
3310+
angleA, angleB : float, default: 0 degrees
3311+
Orientation of the bracket, as a counterclockwise angle.
3312+
0 degrees means perpendicular to the line.
33273313
"""
33283314
super().__init__(True, True,
33293315
widthA=widthA, lengthA=lengthA, angleA=angleA,
@@ -3333,18 +3319,17 @@ def __init__(self,
33333319
class BracketA(_Bracket):
33343320
"""An arrow with an outward square bracket at its start."""
33353321

3336-
def __init__(self, widthA=1., lengthA=0.2, angleA=None):
3322+
def __init__(self, widthA=1., lengthA=0.2, angleA=0):
33373323
"""
33383324
Parameters
33393325
----------
33403326
widthA : float, default: 1.0
33413327
Width of the bracket.
3342-
33433328
lengthA : float, default: 0.2
33443329
Length of the bracket.
3345-
3346-
angleA : float, default: None
3347-
Angle between the bracket and the line.
3330+
angleA : float, default: 0 degrees
3331+
Orientation of the bracket, as a counterclockwise angle.
3332+
0 degrees means perpendicular to the line.
33483333
"""
33493334
super().__init__(True, None,
33503335
widthA=widthA, lengthA=lengthA, angleA=angleA)
@@ -3359,14 +3344,11 @@ def __init__(self, widthB=1., lengthB=0.2, angleB=None):
33593344
----------
33603345
widthB : float, default: 1.0
33613346
Width of the bracket.
3362-
33633347
lengthB : float, default: 0.2
33643348
Length of the bracket.
3365-
3366-
angleB : float, default: None
3367-
Angle, in degrees, between the bracket and the line. Zero is
3368-
perpendicular to the line, and positive measures
3369-
counterclockwise.
3349+
angleB : float, default: 0 degrees
3350+
Orientation of the bracket, as a counterclockwise angle.
3351+
0 degrees means perpendicular to the line.
33703352
"""
33713353
super().__init__(None, True,
33723354
widthB=widthB, lengthB=lengthB, angleB=angleB)
@@ -3381,21 +3363,11 @@ def __init__(self,
33813363
"""
33823364
Parameters
33833365
----------
3384-
widthA : float, default: 1.0
3366+
widthA, widthB : float, default: 1.0
33853367
Width of the bracket.
3386-
3387-
angleA : float, default: None
3388-
Angle, in degrees, between the bracket and the line. Zero is
3389-
perpendicular to the line, and positive measures
3390-
counterclockwise.
3391-
3392-
widthB : float, default: 1.0
3393-
Width of the bracket.
3394-
3395-
angleB : float, default: None
3396-
Angle, in degrees, between the bracket and the line. Zero is
3397-
perpendicular to the line, and positive measures
3398-
counterclockwise.
3368+
angleA, angleB : float, default: 0 degrees
3369+
Orientation of the bracket, as a counterclockwise angle.
3370+
0 degrees means perpendicular to the line.
33993371
"""
34003372
super().__init__(True, True,
34013373
widthA=widthA, lengthA=0, angleA=angleA,

0 commit comments

Comments
 (0)