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

Skip to content

Commit 59abe41

Browse files
committed
DOC: AnnotationBbox keyword descriptions
1 parent d95edc4 commit 59abe41

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-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: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,11 @@ def __init__(self, offsetbox, xy,
12621262
(accessible as the ``patch`` attribute of the `.AnnotationBbox`).
12631263
If *frameon* is set to False, this patch is made invisible.
12641264
1265+
annotation_clip: bool or None, default: None
1266+
Whether to clip (i.e. not draw) the annotation when the annotation
1267+
point *xy* is outside the axes area. see `.Annotation` for
1268+
details.
1269+
12651270
pad : float, default: 0.4
12661271
Padding around the offsetbox.
12671272
@@ -1270,8 +1275,20 @@ def __init__(self, offsetbox, xy,
12701275
the offset box w.r.t. the *boxcoords*.
12711276
The lower-left corner is (0, 0) and upper-right corner is (1, 1).
12721277
1278+
bboxprops : dict, optional
1279+
A dictionary of properties to set for the annotation bounding box,
1280+
for example *boxstyle* and *alpha*. See `.FancyBboxPatch` for
1281+
details.
1282+
1283+
arrowprops: dict, optional
1284+
Arrow properties, see `.Annotation` for description.
1285+
1286+
fontsize: float or str, optional
1287+
Font size, see `~.Text.set_fontsize`.
1288+
12731289
**kwargs
1274-
Other parameters are identical to `.Annotation`.
1290+
Other `AnnotationBbox` properties. See `~.AnnotationBbox.set` for
1291+
a list.
12751292
"""
12761293

12771294
martist.Artist.__init__(self)

0 commit comments

Comments
 (0)