mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes

mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes(parent_axes, zoom, loc='upper right', bbox_to_anchor=None, bbox_transform=None, axes_class=None, axes_kwargs=None, borderpad=0.5)[source]

Create an anchored inset axes by scaling a parent axes. For usage, also see the examples.

Parameters:
parent_axesmatplotlib.axes.Axes

Axes to place the inset axes.

zoomfloat

Scaling factor of the data axes. zoom > 1 will enlarge the coordinates (i.e., "zoomed in"), while zoom < 1 will shrink the coordinates (i.e., "zoomed out").

locstr, default: 'upper right'

Location to place the inset axes. Valid locations are 'upper left', 'upper center', 'upper right', 'center left', 'center', 'center right', 'lower left', 'lower center, 'lower right'. For backward compatibility, numeric values are accepted as well. See the parameter loc of Legend for details.

bbox_to_anchortuple or matplotlib.transforms.BboxBase, optional

Bbox that the inset axes will be anchored to. If None, parent_axes.bbox is used. If a tuple, can be either [left, bottom, width, height], or [left, bottom]. If the kwargs width and/or height are specified in relative units, the 2-tuple [left, bottom] cannot be used. Note that the units of the bounding box are determined through the transform in use. When using bbox_to_anchor it almost always makes sense to also specify a bbox_transform. This might often be the axes transform parent_axes.transAxes.

bbox_transformmatplotlib.transforms.Transform, optional

Transformation for the bbox that contains the inset axes. If None, a transforms.IdentityTransform is used (i.e. pixel coordinates). This is useful when not providing any argument to bbox_to_anchor. When using bbox_to_anchor it almost always makes sense to also specify a bbox_transform. This might often be the axes transform parent_axes.transAxes. Inversely, when specifying the axes- or figure-transform here, be aware that not specifying bbox_to_anchor will use parent_axes.bbox, the units of which are in display (pixel) coordinates.

axes_classmatplotlib.axes.Axes type, default: HostAxes

The type of the newly created inset axes.

axes_kwargsdict, optional

Keyword arguments to pass to the constructor of the inset axes. Valid arguments include:

Property Description
adjustable {'box', 'datalim'}
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
anchor (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
animated bool
aspect {'auto', 'equal'} or float
autoscale_on bool
autoscalex_on bool
autoscaley_on bool
axes_locator Callable[[Axes, Renderer], Bbox]
axisbelow bool or 'line'
box_aspect float or None
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
contains unknown
facecolor or fc color
figure Figure
frame_on bool
gid str
in_layout bool
label object
navigate bool
navigate_mode unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
position [left, bottom, width, height] or Bbox
prop_cycle unknown
rasterization_zorder float or None
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
title str
transform Transform
url str
visible bool
xbound unknown
xlabel str
xlim (bottom: float, top: float)
xmargin float greater than -0.5
xscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
xticklabels unknown
xticks unknown
ybound unknown
ylabel str
ylim (bottom: float, top: float)
ymargin float greater than -0.5
yscale {"linear", "log", "symlog", "logit", ...} or ScaleBase
yticklabels unknown
yticks unknown
zorder float
borderpadfloat, default: 0.5

Padding between inset axes and the bbox_to_anchor. The units are axes font size, i.e. for a default font size of 10 points borderpad = 0.5 is equivalent to a padding of 5 points.

Returns:
inset_axesaxes_class

Inset axes object created.

Examples using mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes