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

Skip to content

Commit 0d209c7

Browse files
committed
Clarify Annotation arrowprops docs
1 parent 73304d2 commit 0d209c7

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

lib/matplotlib/text.py

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,9 +1710,14 @@ 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*.
1714+
1715+
Defaults to None, i.e. no arrow is drawn.
1716+
1717+
For historical reasons there are two different ways of usage, that
1718+
are distinguised by whether 'arrowstyle' is specified in the dict.
1719+
1720+
**Simple arrow:**
17161721
17171722
If *arrowprops* does not contain the key 'arrowstyle' the
17181723
allowed keys are:
@@ -1727,35 +1732,22 @@ def transform(renderer) -> Transform
17271732
? Any key to :class:`matplotlib.patches.FancyArrowPatch`
17281733
========== ======================================================
17291734
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:
1735+
The arrow is attached to the edge of the text box, the exact
1736+
position (corners or centers) depending on where it's pointing to.
1737+
1738+
**Fancy arrow:**
1739+
1740+
This is used if 'arrowstyle' is provided in the *arrowprops*.
1741+
1742+
Valid keys are the following `~matplotlib.patches.FancyArrowPatch`
1743+
parameters:
17521744
17531745
=============== ==================================================
17541746
Key Description
17551747
=============== ==================================================
17561748
arrowstyle the arrow style
17571749
connectionstyle the connection style
1758-
relpos default is (0.5, 0.5)
1750+
relpos see below; default is (0.5, 0.5)
17591751
patchA default is bounding box of the text
17601752
patchB default is None
17611753
shrinkA default is 2 points
@@ -1765,7 +1757,12 @@ def transform(renderer) -> Transform
17651757
? any key for :class:`matplotlib.patches.PathPatch`
17661758
=============== ==================================================
17671759
1768-
Defaults to None, i.e. no arrow is drawn.
1760+
The exact starting point position of the arrow is defined by
1761+
*relpos*. It's a tuple of relative coordinates of the text box,
1762+
where (0, 0) is the lower left corner and (1, 1) is the upper
1763+
right corner. Values <0 and >1 are supported and specify points
1764+
outside the text box. By default (0.5, 0.5) the starting point is
1765+
centered in the text box.
17691766
17701767
annotation_clip : bool or None, default: None
17711768
Whether to draw the annotation when the annotation point *xy* is

0 commit comments

Comments
 (0)