matplotlib.axes.Axes.inset_axes#

Axes.inset_axes(bounds,*,transform=None,zorder=5,**kwargs)[source]#

Add a child inset Axes to this existing Axes.

Parameters:
bounds[x0, y0, width, height]

Lower-left corner of inset Axes, and its width and height.

transformTransform

Defaults toax.transAxes, i.e. the units ofrect are inAxes-relative coordinates.

projection{None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', 'rectilinear', str}, optional

The projection type of the insetAxes.str is the nameof a custom projection, seeprojections. The defaultNone results in a 'rectilinear' projection.

polarbool, default: False

If True, equivalent to projection='polar'.

axes_classsubclass type ofAxes, optional

Theaxes.Axes subclass that is instantiated. This parameteris incompatible withprojection andpolar. Seeaxisartist for examples.

zordernumber

Defaults to 5 (same asAxes.legend). Adjust higher or lowerto change whether it is above or below data plotted on theparent Axes.

**kwargs

Other keyword arguments are passed on to the inset Axes class.

Returns:
ax

The createdAxes instance.

Examples

This example makes two inset Axes, the first is in Axes-relativecoordinates, and the second in data-coordinates:

fig,ax=plt.subplots()ax.plot(range(10))axin1=ax.inset_axes([0.8,0.1,0.15,0.15])axin2=ax.inset_axes([5,7,2.3,2.3],transform=ax.transData)

Examples usingmatplotlib.axes.Axes.inset_axes#

Scatter plot with histograms

Scatter plot with histograms

Zoom region inset Axes

Zoom region inset Axes

Check buttons

Check buttons

Placing colorbars

Placing colorbars