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

Skip to content

Commit 719a1f7

Browse files
committed
add BracketAB arrow style
svn path=/trunk/matplotlib/; revision=8017
1 parent 94cda01 commit 719a1f7

1 file changed

Lines changed: 59 additions & 3 deletions

File tree

lib/matplotlib/patches.py

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3193,7 +3193,7 @@ def transmute(self, path, mutation_size, linewidth):
31933193
cos_t, sin_t = get_cos_sin(x1, y1, x0, y0)
31943194
verticesA, codesA = self._get_bracket(x0, y0, cos_t, sin_t,
31953195
self.widthA*scaleA,
3196-
self.legnthA*scaleA)
3196+
self.lengthA*scaleA)
31973197
vertices_list.append(verticesA)
31983198
codes_list.append(codesA)
31993199

@@ -3218,6 +3218,63 @@ def transmute(self, path, mutation_size, linewidth):
32183218

32193219
return p, False
32203220

3221+
class BracketAB(_Bracket):
3222+
"""
3223+
An arrow with a bracket(]) at both ends.
3224+
"""
3225+
3226+
def __init__(self,
3227+
widthA=1., lengthA=0.2, angleA=None,
3228+
widthB=1., lengthB=0.2, angleB=None):
3229+
"""
3230+
*widthA*
3231+
width of the bracket
3232+
3233+
*lengthA*
3234+
length of the bracket
3235+
3236+
*angleA*
3237+
angle between the bracket and the line
3238+
3239+
*widthB*
3240+
width of the bracket
3241+
3242+
*lengthB*
3243+
length of the bracket
3244+
3245+
*angleB*
3246+
angle between the bracket and the line
3247+
"""
3248+
3249+
super(ArrowStyle.BracketAB, self).__init__(True, True, \
3250+
widthA=widthA, lengthA=lengthA, angleA=angleA,
3251+
widthB=widthB, lengthB=lengthB, angleB=angleB)
3252+
3253+
_style_list["]-["] = BracketAB
3254+
3255+
3256+
class BracketA(_Bracket):
3257+
"""
3258+
An arrow with a bracket(]) at its end.
3259+
"""
3260+
3261+
def __init__(self, widthA=1., lengthA=0.2, angleA=None):
3262+
"""
3263+
*widthA*
3264+
width of the bracket
3265+
3266+
*lengthA*
3267+
length of the bracket
3268+
3269+
*angleA*
3270+
angle between the bracket and the line
3271+
"""
3272+
3273+
super(ArrowStyle.BracketA, self).__init__(None, True,
3274+
widthA=widthA, lengthA=lengthA, angleA=angleA )
3275+
3276+
_style_list["]-"] = BracketA
3277+
32213278

32223279
class BracketB(_Bracket):
32233280
"""
@@ -3237,9 +3294,8 @@ def __init__(self, widthB=1., lengthB=0.2, angleB=None):
32373294
"""
32383295

32393296
super(ArrowStyle.BracketB, self).__init__(None, True,
3240-
widthB=widthB, lengthB=lengthB, angleB=None )
3297+
widthB=widthB, lengthB=lengthB, angleB=angleB )
32413298

3242-
#_style_list["-["] = BracketB
32433299
_style_list["-["] = BracketB
32443300

32453301

0 commit comments

Comments
 (0)