inse2DAbsolute creates an axes inset, defined using the larger axes, and corresponding annotations
Updated 6 Oct 2011

View License

[ insetAxesHandle rectHandle rectHandleInset annHandles] = inset2DAbsolute(axesHandle, insetLoc, style, rectLoc, varargin)

inset2DAbsolute creates a new axes located within the specified axes (identified by axesHandle) along with corresponding rectangle/lines/arrows as indicated by style. The axes location is defined using coordinates within axesHandle, rather than percentages of the figure.

If 'ZOOMN' or 'ARROW' are selected for the style variable, rectangles are added to both the inset and parent axes to identify the data and the inset is automatically populated with the appropriate data. If only an inset is desired, simply leave style undefined or set to [].

Handles are returned so that the insets, rectangles, and annotations (lines/arrows) can be customized.


% Generate and Plot Data
x = -10:.1:10;
y = sinc(x);

% Define input arguments and create inset
insetLoc = [2 8;.4 .8];
style = 'ARROW';
rectLoc = [6 8;-.1 .1];
inset2DAbsolute(gca,insetLoc,style,rectLoc,'Color',[0 0 0],'LineWidth',2);

CAVEAT: Although the inset data is correctly mapped and appears to be correctly color-coded, the "RGB" values that are obtained from a data cursor are incorrect.

Cite As

James Hall (2024). inset2DAbsolute (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Visual Exploration in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes