FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

DOC: AnnotationBbox keyword descriptions by rcomer · Pull Request #24444 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
xybox=(-20, 40),
xycoords='data',
boxcoords="offset points",
arrowprops=dict(arrowstyle="->"))
arrowprops=dict(arrowstyle="->"),
bboxprops=dict(boxstyle="sawtooth"))
ax.add_artist(ab)

# Annotate the 1st position with another text box ('Test')
Expand All @@ -54,11 +55,12 @@
da.add_artist(p)

ab = AnnotationBbox(da, xy,
xybox=(1.02, xy[1]),
xybox=(1., xy[1]),
xycoords='data',
boxcoords=("axes fraction", "data"),
box_alignment=(0., 0.5),
arrowprops=dict(arrowstyle="->"))
box_alignment=(0.2, 0.5),
arrowprops=dict(arrowstyle="->"),
bboxprops=dict(alpha=0.5))

ax.add_artist(ab)

Expand Down
29 changes: 28 additions & 1 deletion lib/matplotlib/offsetbox.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,16 @@ def __init__(self, offsetbox, xy,
(accessible as the ``patch`` attribute of the `.AnnotationBbox`).
If *frameon* is set to False, this patch is made invisible.

annotation_clip: bool or None, default: None
Whether to clip (i.e. not draw) the annotation when the annotation
point *xy* is outside the axes area.

- If *True*, the annotation will be clipped when *xy* is outside
the axes.
- If *False*, the annotation will always be drawn.
- If *None*, the annotation will be clipped when *xy* is outside
the axes and *xycoords* is 'data'.

pad : float, default: 0.4
Padding around the offsetbox.

Expand All @@ -1270,8 +1280,25 @@ def __init__(self, offsetbox, xy,
the offset box w.r.t. the *boxcoords*.
The lower-left corner is (0, 0) and upper-right corner is (1, 1).

bboxprops : dict, optional
A dictionary of properties to set for the annotation bounding box,
for example *boxstyle* and *alpha*. See `.FancyBboxPatch` for
details.

arrowprops: dict, optional
Arrow properties, see `.Annotation` for description.

fontsize: float or str, optional
Translated to points and passed as *mutation_scale* into
`.FancyBboxPatch` to scale attributes of the box style (e.g. pad
or rounding_size). The name is chosen in analogy to `.Text` where
*fontsize* defines the mutation scale as well. If not given,
:rc:`legend.fontsize` is used. See `.Text.set_fontsize` for valid
values.

**kwargs
Other parameters are identical to `.Annotation`.
Other `AnnotationBbox` properties. See `.AnnotationBbox.set` for
a list.
"""

martist.Artist.__init__(self)
Expand Down

Back | FazBrowse Home | New Git URL