image thumbnail


version (2.63 KB) by Damien
A simple function to add a magnified inset into a figure.


Updated 19 Mar 2015

View License

MagInset provides a one-line solution to add a magnified inset to a figure. The best way to learn how to use the function is to take a look at the example provided. The zip file includes:
MagInset.m - the function itself
MagInsetEx.m - a script which shows how to use MagInset.m using two examples.
- Works with single axes figures and multiple (subplot) figures.
- Inset size and position is specified using the data's co-ordinate system, not the normalized figure co-ordinate system, for ease of use.
- Can freely specify the zoom area (the region to be magnified in the inset), the inset size, the inset position, and lines that connect the inset to the zoom area.
Limitations (some of which I hope to address in the future):
- The figure size and axes position must be specified before using the MagInset function.
- The appearance of the inset axes is hard coded.

Inspiration drawn from "inset figure" via Robert R.

Cite As

Damien (2021). MagInset (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: figure inset

Community Treasure Hunt

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

Start Hunting!