Skip to content

Commit 0d42d1e

Browse files
committed
Document that angles are accepted in bracket arrowstyles.
1 parent 3ff569e commit 0d42d1e

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Angles on Bracket arrow styles
2+
------------------------------
3+
4+
Angles specified on the *Bracket* arrow styles (``]-[``, ``]-``, ``-[``, or
5+
``|-|`` passed to *arrowstyle* parameter of `.FancyArrowPatch`) are now
6+
applied. Previously, the *angleA* and *angleB* options were allowed, but did
7+
nothing.
8+
9+
.. plot::
10+
11+
import matplotlib.pyplot as plt
12+
import matplotlib.patches as mpatches
13+
14+
fig, ax = plt.subplots()
15+
ax.set(xlim=(0, 1), ylim=(-1, 4))
16+
17+
for i, stylename in enumerate((']-[', '|-|')):
18+
for j, angle in enumerate([-30, 60]):
19+
arrowstyle = f'{stylename},angleA={angle},angleB={-angle}'
20+
patch = mpatches.FancyArrowPatch((0.1, 2*i + j), (0.9, 2*i + j),
21+
arrowstyle=arrowstyle,
22+
mutation_scale=25)
23+
ax.text(0.5, 2*i + j, arrowstyle,
24+
verticalalignment='bottom', horizontalalignment='center')
25+
ax.add_patch(patch)

lib/matplotlib/patches.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,7 +3293,9 @@ def __init__(self,
32933293
Length of the bracket.
32943294
32953295
angleA : float, default: None
3296-
Angle between the bracket and the line.
3296+
Angle, in degrees, between the bracket and the line. Zero is
3297+
perpendicular to the line, and positive measures
3298+
counterclockwise.
32973299
32983300
widthB : float, default: 1.0
32993301
Width of the bracket.
@@ -3302,7 +3304,9 @@ def __init__(self,
33023304
Length of the bracket.
33033305
33043306
angleB : float, default: None
3305-
Angle between the bracket and the line.
3307+
Angle, in degrees, between the bracket and the line. Zero is
3308+
perpendicular to the line, and positive measures
3309+
counterclockwise.
33063310
"""
33073311
super().__init__(True, True,
33083312
widthA=widthA, lengthA=lengthA, angleA=angleA,
@@ -3343,7 +3347,9 @@ def __init__(self, widthB=1., lengthB=0.2, angleB=None):
33433347
Length of the bracket.
33443348
33453349
angleB : float, default: None
3346-
Angle between the bracket and the line.
3350+
Angle, in degrees, between the bracket and the line. Zero is
3351+
perpendicular to the line, and positive measures
3352+
counterclockwise.
33473353
"""
33483354
super().__init__(None, True,
33493355
widthB=widthB, lengthB=lengthB, angleB=angleB)
@@ -3362,13 +3368,17 @@ def __init__(self,
33623368
Width of the bracket.
33633369
33643370
angleA : float, default: None
3365-
Angle between the bracket and the line.
3371+
Angle, in degrees, between the bracket and the line. Zero is
3372+
perpendicular to the line, and positive measures
3373+
counterclockwise.
33663374
33673375
widthB : float, default: 1.0
33683376
Width of the bracket.
33693377
33703378
angleB : float, default: None
3371-
Angle between the bracket and the line.
3379+
Angle, in degrees, between the bracket and the line. Zero is
3380+
perpendicular to the line, and positive measures
3381+
counterclockwise.
33723382
"""
33733383
super().__init__(True, True,
33743384
widthA=widthA, lengthA=0, angleA=angleA,

0 commit comments

Comments
 (0)