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

Function mark_inset

lib/mpl_toolkits/axes_grid1/inset_locator.py:476–524  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

474
475@_docstring.interpd
476def 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

Callers 6

test_inset_locatorFunction · 0.90
test_inset_axesFunction · 0.90
test_fill_facecolorFunction · 0.90
test_gettightbboxFunction · 0.90

Calls 6

BboxPatchClass · 0.85
BboxConnectorClass · 0.85
intersectionMethod · 0.80
add_patchMethod · 0.80
set_clip_onMethod · 0.45

Tested by 5

test_inset_locatorFunction · 0.72
test_inset_axesFunction · 0.72
test_fill_facecolorFunction · 0.72
test_gettightbboxFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…