astronomix.plotting_helpers.inset_box#
Add a zoomed-in inset axes to an existing matplotlib axes.
Replicates the line and scatter artists of a parent axes inside a magnified inset box (preserving styling such as colors, markers, sizes and colormaps) and draws connector lines between the inset and the highlighted region. Useful for emphasizing a small feature of a plot without a second figure.
Module Contents#
Functions#
Add a magnified inset axes mirroring the artists of |
API#
- astronomix.plotting_helpers.inset_box.add_inset_box(ax, x1, x2, y1, y2, loc='lower left', connect_loc1=2, connect_loc2=4, width='40%', height='40%')[source]#
Add a magnified inset axes mirroring the artists of
ax.- Args:
ax: The parent axes whose line and scatter artists are replicated. x1: The left edge of the zoomed-in x-range. x2: The right edge of the zoomed-in x-range. y1: The lower edge of the zoomed-in y-range. y2: The upper edge of the zoomed-in y-range. loc: The location of the inset within the parent axes. connect_loc1: The first corner used for the inset connector lines. connect_loc2: The second corner used for the inset connector lines. width: The inset width (as a fraction string or absolute size). height: The inset height (as a fraction string or absolute size).
- Returns:
The created inset axes.