Draw a box to mark the location of an area represented by an inset axes. This function draws a box in *parent_axes* at the bounding box of *inset_axes*, and shows a connection with the inset axes by drawing lines at the corners, giving a "zoomed in" effect. Parameters ----
(parent_axes, inset_axes, loc1, loc2, **kwargs)
| 474 | |
| 475 | @_docstring.interpd |
| 476 | def mark_inset(parent_axes, inset_axes, loc1, loc2, **kwargs): |
| 477 | """ |
| 478 | Draw a box to mark the location of an area represented by an inset axes. |
| 479 | |
| 480 | This function draws a box in *parent_axes* at the bounding box of |
| 481 | *inset_axes*, and shows a connection with the inset axes by drawing lines |
| 482 | at the corners, giving a "zoomed in" effect. |
| 483 | |
| 484 | Parameters |
| 485 | ---------- |
| 486 | parent_axes : `~matplotlib.axes.Axes` |
| 487 | Axes which contains the area of the inset axes. |
| 488 | |
| 489 | inset_axes : `~matplotlib.axes.Axes` |
| 490 | The inset axes. |
| 491 | |
| 492 | loc1, loc2 : {1, 2, 3, 4} |
| 493 | Corners to use for connecting the inset axes and the area in the |
| 494 | parent axes. |
| 495 | |
| 496 | **kwargs |
| 497 | Patch properties for the lines and box drawn: |
| 498 | |
| 499 | %(Patch:kwdoc)s |
| 500 | |
| 501 | Returns |
| 502 | ------- |
| 503 | pp : `~matplotlib.patches.Patch` |
| 504 | The patch drawn to represent the area of the inset axes. |
| 505 | |
| 506 | p1, p2 : `~matplotlib.patches.Patch` |
| 507 | The patches connecting two corners of the inset axes and its area. |
| 508 | """ |
| 509 | rect = _TransformedBboxWithCallback( |
| 510 | inset_axes.viewLim, parent_axes.transData, |
| 511 | callback=parent_axes._unstale_viewLim) |
| 512 | |
| 513 | kwargs.setdefault("fill", bool({'fc', 'facecolor', 'color'}.intersection(kwargs))) |
| 514 | pp = BboxPatch(rect, **kwargs) |
| 515 | parent_axes.add_patch(pp) |
| 516 | |
| 517 | p1 = BboxConnector(inset_axes.bbox, rect, loc1=loc1, **kwargs) |
| 518 | inset_axes.add_patch(p1) |
| 519 | p1.set_clip_on(False) |
| 520 | p2 = BboxConnector(inset_axes.bbox, rect, loc1=loc2, **kwargs) |
| 521 | inset_axes.add_patch(p2) |
| 522 | p2.set_clip_on(False) |
| 523 | |
| 524 | return pp, p1, p2 |
searching dependent graphs…