Code covered by the BSD License  

Highlights from
ZoomBox

4.66667

4.7 | 3 ratings Rate this file 18 Downloads (last 30 days) File Size: 25.81 KB File ID: #2884
image thumbnail

ZoomBox

by Doug Hull

 

27 Dec 2002 (Updated 30 Dec 2009)

Movable, stretchable zoom box in parent axes controls axes limits in all children axes.

| Watch this File

File Information
Description

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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
moveplot.m, Mastering Mechanics 1: Using MATLAB 5
This submission has inspired the following:
On-figure magnifier

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
03 Mar 2004 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

set(hChildAxis,'XTickLabel',datestr(get(hChildAxis,'XTick'),'HH:MM'));

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

01 Jul 2004 Ugo Di Girolamo  
09 Jan 2009 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).

25 Dec 2009 Evgeny Pr

Great idea! Useful tool.

05 Jan 2011 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(:)]);
 
>>

08 Dec 2011 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.

08 May 2012 Vida

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
x=(0:0.001:25);

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
p=plot(hParentAxes,x,y);
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?

Please login to add a comment or rating.
Updates
06 Jan 2003

Modified to support
multiple figures,
large data sets,
cursors that change with shape to show function,
cleaned up the code in general,
return hold to original state,
removed dependency on MOVEPLOT by Brandon K,
added some HTML doc.

17 Nov 2003

Modified to support
multiple figures,
large data sets,
cursors that change with shape to show function,
cleaned up the code in general,
return hold to original state,
removed dependency on MOVEPLOT by Brandon K,
added some HTML doc.

23 Dec 2009

generating license

30 Dec 2009

copyright

Tag Activity for this File
Tag Applied By Date/Time
data exploration Doug Hull 22 Oct 2008 06:55:35
zoom Doug Hull 22 Oct 2008 06:55:35
pan Doug Hull 22 Oct 2008 06:55:35
linked zoom Doug Hull 22 Oct 2008 06:55:35
subplot Doug Hull 22 Oct 2008 06:55:35
telemetry Doug Hull 22 Oct 2008 06:55:35
multiple plot Doug Hull 22 Oct 2008 06:55:35

Contact us at files@mathworks.com