Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2d3e45f

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR matplotlib#24444: DOC: AnnotationBbox keyword descriptions
1 parent 44a268e commit 2d3e45f

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

‎examples/text_labels_and_annotations/demo_annotation_box.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
xybox=(-20, 40),
3232
xycoords='data',
3333
boxcoords="offset points",
34-
arrowprops=dict(arrowstyle="->"))
34+
arrowprops=dict(arrowstyle="->"),
35+
bboxprops=dict(boxstyle="sawtooth"))
3536
ax.add_artist(ab)
3637

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

5657
ab = AnnotationBbox(da, xy,
57-
xybox=(1.02, xy[1]),
58+
xybox=(1., xy[1]),
5859
xycoords='data',
5960
boxcoords=("axes fraction", "data"),
60-
box_alignment=(0., 0.5),
61-
arrowprops=dict(arrowstyle="->"))
61+
box_alignment=(0.2, 0.5),
62+
arrowprops=dict(arrowstyle="->"),
63+
bboxprops=dict(alpha=0.5))
6264

6365
ax.add_artist(ab)
6466

‎lib/matplotlib/offsetbox.py‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,16 @@ def __init__(self, offsetbox, xy,
13131313
(accessible as the ``patch`` attribute of the `.AnnotationBbox`).
13141314
If *frameon* is set to False, this patch is made invisible.
13151315
1316+
annotation_clip: bool or None, default: None
1317+
Whether to clip (i.e. not draw) the annotation when the annotation
1318+
point *xy* is outside the axes area.
1319+
1320+
- If *True*, the annotation will be clipped when *xy* is outside
1321+
the axes.
1322+
- If *False*, the annotation will always be drawn.
1323+
- If *None*, the annotation will be clipped when *xy* is outside
1324+
the axes and *xycoords* is 'data'.
1325+
13161326
pad : float, default: 0.4
13171327
Padding around the offsetbox.
13181328
@@ -1321,8 +1331,25 @@ def __init__(self, offsetbox, xy,
13211331
the offset box w.r.t. the *boxcoords*.
13221332
The lower-left corner is (0, 0) and upper-right corner is (1, 1).
13231333
1334+
bboxprops : dict, optional
1335+
A dictionary of properties to set for the annotation bounding box,
1336+
for example *boxstyle* and *alpha*. See `.FancyBboxPatch` for
1337+
details.
1338+
1339+
arrowprops: dict, optional
1340+
Arrow properties, see `.Annotation` for description.
1341+
1342+
fontsize: float or str, optional
1343+
Translated to points and passed as *mutation_scale* into
1344+
`.FancyBboxPatch` to scale attributes of the box style (e.g. pad
1345+
or rounding_size). The name is chosen in analogy to `.Text` where
1346+
*fontsize* defines the mutation scale as well. If not given,
1347+
:rc:`legend.fontsize` is used. See `.Text.set_fontsize` for valid
1348+
values.
1349+
13241350
**kwargs
1325-
Other parameters are identical to `.Annotation`.
1351+
Other `AnnotationBbox` properties. See `.AnnotationBbox.set` for
1352+
a list.
13261353
"""
13271354

13281355
martist.Artist.__init__(self)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /