MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / AnnotationBbox

Class AnnotationBbox

lib/matplotlib/offsetbox.py:1291–1531  ·  view source on GitHub ↗

Container for an `OffsetBox` referring to a specific position *xy*. Optionally an arrow pointing from the offsetbox to *xy* can be drawn. This is like `.Annotation`, but with `OffsetBox` instead of `.Text`.

Source from the content-addressed store, hash-verified

1289
1290
1291class AnnotationBbox(martist.Artist, mtext._AnnotationBase):
1292 """
1293 Container for an `OffsetBox` referring to a specific position *xy*.
1294
1295 Optionally an arrow pointing from the offsetbox to *xy* can be drawn.
1296
1297 This is like `.Annotation`, but with `OffsetBox` instead of `.Text`.
1298 """
1299
1300 zorder = 3
1301
1302 def __str__(self):
1303 return f"AnnotationBbox({self.xy[0]:g},{self.xy[1]:g})"
1304
1305 @_docstring.interpd
1306 def __init__(self, offsetbox, xy, xybox=None, xycoords='data', boxcoords=None, *,
1307 frameon=True, pad=0.4, # FancyBboxPatch boxstyle.
1308 annotation_clip=None,
1309 box_alignment=(0.5, 0.5),
1310 bboxprops=None,
1311 arrowprops=None,
1312 fontsize=None,
1313 **kwargs):
1314 """
1315 Parameters
1316 ----------
1317 offsetbox : `OffsetBox`
1318
1319 xy : (float, float)
1320 The point *(x, y)* to annotate. The coordinate system is determined
1321 by *xycoords*.
1322
1323 xybox : (float, float), default: *xy*
1324 The position *(x, y)* to place the text at. The coordinate system
1325 is determined by *boxcoords*.
1326
1327 xycoords : single or two-tuple of str or `.Artist` or `.Transform` or \
1328callable, default: 'data'
1329 The coordinate system that *xy* is given in. See the parameter
1330 *xycoords* in `.Annotation` for a detailed description.
1331
1332 boxcoords : single or two-tuple of str or `.Artist` or `.Transform` \
1333or callable, default: value of *xycoords*
1334 The coordinate system that *xybox* is given in. See the parameter
1335 *textcoords* in `.Annotation` for a detailed description.
1336
1337 frameon : bool, default: True
1338 By default, the text is surrounded by a white `.FancyBboxPatch`
1339 (accessible as the ``patch`` attribute of the `.AnnotationBbox`).
1340 If *frameon* is set to False, this patch is made invisible.
1341
1342 annotation_clip: bool or None, default: None
1343 Whether to clip (i.e. not draw) the annotation when the annotation
1344 point *xy* is outside the Axes area.
1345
1346 - If *True*, the annotation will be clipped when *xy* is outside
1347 the Axes.
1348 - If *False*, the annotation will always be drawn.

Callers 8

test_annotationbbox_gidFunction · 0.90
test_pickingFunction · 0.90
test_arrowprops_copiedFunction · 0.90
annotations.pyFile · 0.90
demo_text_path.pyFile · 0.90

Calls

no outgoing calls

Tested by 5

test_annotationbbox_gidFunction · 0.72
test_pickingFunction · 0.72
test_arrowprops_copiedFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…