Annotation-like class, but with offsetbox instead of Text.
| 1363 | |
| 1364 | |
| 1365 | class AnnotationBbox(martist.Artist, _AnnotationBase): |
| 1366 | """ |
| 1367 | Annotation-like class, but with offsetbox instead of Text. |
| 1368 | """ |
| 1369 | zorder = 3 |
| 1370 | |
| 1371 | def __str__(self): |
| 1372 | return "AnnotationBbox(%g,%g)" % (self.xy[0], self.xy[1]) |
| 1373 | |
| 1374 | @docstring.dedent_interpd |
| 1375 | def __init__(self, offsetbox, xy, |
| 1376 | xybox=None, |
| 1377 | xycoords='data', |
| 1378 | boxcoords=None, |
| 1379 | frameon=True, pad=0.4, # BboxPatch |
| 1380 | annotation_clip=None, |
| 1381 | box_alignment=(0.5, 0.5), |
| 1382 | bboxprops=None, |
| 1383 | arrowprops=None, |
| 1384 | fontsize=None, |
| 1385 | **kwargs): |
| 1386 | """ |
| 1387 | *offsetbox* : OffsetBox instance |
| 1388 | |
| 1389 | *xycoords* : same as Annotation but can be a tuple of two |
| 1390 | strings which are interpreted as x and y coordinates. |
| 1391 | |
| 1392 | *boxcoords* : similar to textcoords as Annotation but can be a |
| 1393 | tuple of two strings which are interpreted as x and y |
| 1394 | coordinates. |
| 1395 | |
| 1396 | *box_alignment* : a tuple of two floats for a vertical and |
| 1397 | horizontal alignment of the offset box w.r.t. the *boxcoords*. |
| 1398 | The lower-left corner is (0.0) and upper-right corner is (1.1). |
| 1399 | |
| 1400 | other parameters are identical to that of Annotation. |
| 1401 | """ |
| 1402 | |
| 1403 | martist.Artist.__init__(self, **kwargs) |
| 1404 | _AnnotationBase.__init__(self, |
| 1405 | xy, |
| 1406 | xycoords=xycoords, |
| 1407 | annotation_clip=annotation_clip) |
| 1408 | |
| 1409 | self.offsetbox = offsetbox |
| 1410 | |
| 1411 | self.arrowprops = arrowprops |
| 1412 | |
| 1413 | self.set_fontsize(fontsize) |
| 1414 | |
| 1415 | if xybox is None: |
| 1416 | self.xybox = xy |
| 1417 | else: |
| 1418 | self.xybox = xybox |
| 1419 | |
| 1420 | if boxcoords is None: |
| 1421 | self.boxcoords = xycoords |
| 1422 | else: |