Skip to content

Commit daff489

Browse files
authored
Merge pull request #21810 from meeseeksmachine/auto-backport-of-pr-21743-on-v3.5.x
Backport PR #21743 on branch v3.5.x (Clarify Annotation arrowprops docs)
2 parents 2e00405 + 82c9d5d commit daff489

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

lib/matplotlib/text.py

+23-27
Original file line numberDiff line numberDiff line change
@@ -1710,9 +1710,13 @@ def transform(renderer) -> Transform
17101710
17111711
arrowprops : dict, optional
17121712
The properties used to draw a `.FancyArrowPatch` arrow between the
1713-
positions *xy* and *xytext*. Note that the edge of the arrow
1714-
pointing to *xytext* will be centered on the text itself and may
1715-
not point directly to the coordinates given in *xytext*.
1713+
positions *xy* and *xytext*. Defaults to None, i.e. no arrow is
1714+
drawn.
1715+
1716+
For historical reasons there are two different ways to specify
1717+
arrows, "simple" and "fancy":
1718+
1719+
**Simple arrow:**
17161720
17171721
If *arrowprops* does not contain the key 'arrowstyle' the
17181722
allowed keys are:
@@ -1727,35 +1731,22 @@ def transform(renderer) -> Transform
17271731
? Any key to :class:`matplotlib.patches.FancyArrowPatch`
17281732
========== ======================================================
17291733
1730-
If *arrowprops* contains the key 'arrowstyle' the
1731-
above keys are forbidden. The allowed values of
1732-
``'arrowstyle'`` are:
1733-
1734-
============ =============================================
1735-
Name Attrs
1736-
============ =============================================
1737-
``'-'`` None
1738-
``'->'`` head_length=0.4,head_width=0.2
1739-
``'-['`` widthB=1.0,lengthB=0.2,angleB=None
1740-
``'|-|'`` widthA=1.0,widthB=1.0
1741-
``'-|>'`` head_length=0.4,head_width=0.2
1742-
``'<-'`` head_length=0.4,head_width=0.2
1743-
``'<->'`` head_length=0.4,head_width=0.2
1744-
``'<|-'`` head_length=0.4,head_width=0.2
1745-
``'<|-|>'`` head_length=0.4,head_width=0.2
1746-
``'fancy'`` head_length=0.4,head_width=0.4,tail_width=0.4
1747-
``'simple'`` head_length=0.5,head_width=0.5,tail_width=0.2
1748-
``'wedge'`` tail_width=0.3,shrink_factor=0.5
1749-
============ =============================================
1750-
1751-
Valid keys for `~matplotlib.patches.FancyArrowPatch` are:
1734+
The arrow is attached to the edge of the text box, the exact
1735+
position (corners or centers) depending on where it's pointing to.
1736+
1737+
**Fancy arrow:**
1738+
1739+
This is used if 'arrowstyle' is provided in the *arrowprops*.
1740+
1741+
Valid keys are the following `~matplotlib.patches.FancyArrowPatch`
1742+
parameters:
17521743
17531744
=============== ==================================================
17541745
Key Description
17551746
=============== ==================================================
17561747
arrowstyle the arrow style
17571748
connectionstyle the connection style
1758-
relpos default is (0.5, 0.5)
1749+
relpos see below; default is (0.5, 0.5)
17591750
patchA default is bounding box of the text
17601751
patchB default is None
17611752
shrinkA default is 2 points
@@ -1765,7 +1756,12 @@ def transform(renderer) -> Transform
17651756
? any key for :class:`matplotlib.patches.PathPatch`
17661757
=============== ==================================================
17671758
1768-
Defaults to None, i.e. no arrow is drawn.
1759+
The exact starting point position of the arrow is defined by
1760+
*relpos*. It's a tuple of relative coordinates of the text box,
1761+
where (0, 0) is the lower left corner and (1, 1) is the upper
1762+
right corner. Values <0 and >1 are supported and specify points
1763+
outside the text box. By default (0.5, 0.5) the starting point is
1764+
centered in the text box.
17691765
17701766
annotation_clip : bool or None, default: None
17711767
Whether to draw the annotation when the annotation point *xy* is

0 commit comments

Comments
 (0)