File Exchange

image thumbnail


version (25.8 KB) by Doug Hull
Movable, stretchable zoom box in parent axes controls axes limits in all children axes.


Updated 01 Sep 2016

View Version History

View License

Move this box around to zoom in on or pan across another axes. Similar in functionality to SPTOOL zoom and pan.
Ideal for signal processing, large data sets, and time series data.

Cite As

Doug Hull (2021). ZoomBox (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (8)


don't work with MATLAB 2012b!!


I am trying to use the zoombox, but the box does not show any data.

This is my code-- The way I am trying to call the zoombox

y = 1.5*cos(x) + 6*exp(-.1*x) + exp(.07*x).*sin(3*x);
hChildAxes = subplot(2,1,1); %child
plot([2 3 4],0)
hParentAxes = subplot(2,1,2); %parent
ym = mean(y);
hold on
plot(hParentAxes,[min(x) max(x)],[ym ym],'Color','red')
hold off

ylab = get(hParentAxes,'YTick')
set(hParentAxes,'YTick',sort([ylab ym]))
zoomBox(hParentAxes, hChildAxes,0)

Please help!!

If you have a code that uses this and works could you share it with me please?

Doug Eastman

MATLAB's new case sensitivity is leading to that error. You need to rename all instances of isAppData to isappdata and it works again.

Jacques Larue

Hi I tried the exemple but got errors :

??? Undefined function or method 'isAppData' for input arguments of type 'double'.

Error in ==> zoomBox>isChildAxes at 170
flag = isAppData(hAxes, 'hZBparentAxes');

Error in ==> zoomBox>isZoomBoxAxes at 178
flag = isChildAxes(hAxes) | isParentAxes(hAxes);

Error in ==> zoomBox>destroyExistingZoomBoxes at 208
if isZoomBoxAxes(hAxesList(i))

Error in ==> zoomBox at 110
destroyExistingZoomBoxes([hParentAxes; hChildAxes(:)]);


Evgeny Pr

Great idea! Useful tool.

MM Marinelli

Very useful!!!

Just one thing: If you use MatLab under UNIX, it is necessary to modify the "isAppData" function called by ZoomBox.m in "isappdata" (i.e: eliminate capitals from the name of the function).

Ugo Di Girolamo

Torsten Frank

Great! Absolutely flawless usability.

Added some lines, so that it displays and updates dateticks on the axes. For my case hours in the top subplot and days in the parentaxes (first vector has to be serial dates of course):

after row 28 of refreshAxesandZoomBoxfromAppData.m


and the same after the plot commands in the example.m script with the appropriate date format strings for child and parent axes.

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

Inspired by: moveplot.m, Mastering Mechanics 1: Using MATLAB 5

Inspired: On-figure magnifier

Community Treasure Hunt

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

Start Hunting!