4.8

4.8 | 15 ratings Rate this file 214 downloads (last 30 days) File Size: 59.13 KB File ID: #14984

ScrollPlot - scrollable X/Y axes

by Yair Altman

 

14 May 2007 (Updated 15 Jun 2007)

No BSD License  

ScrollPlot adds a scroll sub-window to any supplied plot handles.

Download Now | Watch this File

File Information
Description

ScrollPlot adds a scroll sub-window to any supplied plot handles (or current [gca] axes if no handle was supplied). This enables easy plot or image exploration.

The user may specify initial view window parameters or use the defaults.

Dragging the side-bars or central patch modifies the parent axes limits interactively. Conversely, modifying the parent axes limits (with zoom, pan or programatically) modifies the corresponding scroll patch(es).

Both X & Y scrolling are possible.

Scrollplot works ok with log and reverse axes. ScrollPlot works on Matlab 6 (R12) and up.

Syntax:
scrollHandles = scrollplot(plotHandles, propName,propValue,...)

Examples:
>> scrollplot; % add scroll sub-window to the current axes (gca)
>> scrollplot(plot(xdata,ydata), 'WindowSize',50); % plot with initial zoom
>> scrollplot('Min',20, 'windowsize',70); % add x-scroll to current axes
>> scrollplot([h1,h2], 'axis','xy'); % scroll both X&Y of 2 plot axes
>> scrollplot('axis','xy', 'minx',20, 'miny',10); % separate scroll minima

See extensive help within.

Warning:
This code relies in [small] part on undocumented and unsupported Matlab functionality. It works on Matlab 6+, but use at your own risk!

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

Change log:
See the bottom of this webpage

This ScrollPlot was inspired by Steve Lord's scrollplot demo submission, but is an entirely new implementation with lots of new functionality.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Scrolling Plot Demo
This submission has inspired the following:
UISplitPane - Split a container (figure/frame/uipanel) into two resizable sub-containers

MATLAB release MATLAB 6.0 (R12)
Other requirements Works on Matlab 6+. Might not work on versions earlier than 6.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (23)
14 May 2007 urs (us) schwarz

an excellent help section and a great, compatibility-aware engine, which is neatly arranged by subfunctions and comes with copious error check-points as well as interesting use of many try-catch blocks, make this application a must-have for people in need of visual data exploration.
could be a ML stock function...
very well done.
us

14 May 2007 John D'Errico

A very nice tool in all respects. Well done.

I did notice that when I tried to add both an x and a y scrollbar, I had to be careful. Since the first call adds a second set of axes, if you are not careful, the second scrollbar may be attached to the set of axes created for the first scrollbar. This is easy to deal with of course.

I also wondered why an allowable option for the 'axis' property was not 'xy'. This would resolve the minor issue that I tripped over.

16 May 2007 F Moisy

Great!
I give 4.99 stars to this submission. I would
happily raise up to 5.00 stars with the following minor improvements:
- Use the same symbols in the subwindow than in the window.
- when calling twice "scrollplot", it adds a (probably unwanted) "sub-sub-window".
- it behaves strangely with log scale.
- add a "scrollplot off" option to remove the subwindow.

Many thanks!

16 May 2007 Yair Altman

A new version has just been posted with fixes per John D'Errico's comments (thanks). However, I found out yesterday that this second version had a few bugs so I immediately posted a third version with fixes. I suggest that users wait for this new version (titled 2007-05-15), and NOT download the 2007-05-14 version. I hope the new version will be up in a few hours or by tomorrow. Sorry for the mixup.

16 May 2007 Yair Altman

The corrected version is now available for download. A new version will be posted in a few days with support for Fredric Moisy's suggestions (improved log-scaling behavior & automatic parent axes resizing on scroll axes deletion/hiding).

30 May 2007 Dadi Gudmundsson

Very useful for the exploration of large plots. Highly recommended.

07 Jun 2007 Ol Mik  
08 Jul 2008 Santosh Kandregula

Hello Yair,
Your Scrollplot m-file is really great. i t helped me a lot.
But when I am trying to throw the figure into GUI, the scrollable thing doesn't work.
Can you please help as how this can be made, so that it can work in GUI.

Thanks,
Santosh.

09 Jul 2008 Felipe raposo

does anyone tryed to use ScrollPlot with datetickzoom / tlabel ? it bugs..

13 Aug 2008 Sellavelu Sathyapriya

I have a gui with two axes. For one axes, I want to use the scrollplot. I tried using it, but it is not scrolling. At the same time when I tried to plot the graph, using 'figure' and then use scrollplot, it works. Why it doesn't work in the gui? Do I have to modify axes settings? Can you help?
Thanks.

10 Sep 2008 K Parsons

Excellent. However, this gives a warning with Matlab 2008b -- Warning: figure JavaFrame property will be obsoleted in a future release.

29 Jan 2009 puru

This is really an excellent utility..!!
Yair,

One question. How can I include this utility in the GUI programming?

I simply had a GUI template which has,
1) Axis component
2)pushbutton component

I tried following code in the pushbutton callback,
x=0:10;
y=0:10;
plot(x,y);

and it works fine.

But when I tried following different codes,
1.scrollplot(plot(x,y));
2.scrollplot(handles.axes1,plot(x,y));
3.scrollplot(handles.axes1,plot(x,y),'axis','xy', 'minx',0,'maxx',10, 'miny',0,'maxy',10);
4.scrollplot(plot(x,y),'axis','xy', 'minx',0,'maxx',10, 'miny',0,'maxy',10);

none of them worked...!! It just shows those scrolling bars but does not work. I want to use this excellent utility in my GUI - will you plese suggest me how can I use it?

Versions I tried,
1.Matlab6.1 R12.1
2.Matlab7 R7007a

Thank you in Advance!!
~puru

20 Feb 2009 Lukas Lansky

Nice. One command test of this function.
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy','minx',5,'miny',0.5);

14 May 2009 Ward Jennekens

Very nice utility! One question: when I remove a plot point with the 'selectdata' tool, the scrollbar will not function actively any more, only passively follow zoom alterations. Is there any way to (re)set focus to the scrollbar again?

14 May 2009 Rene

very nice.
but if i plot some data, it looks fine
if i wanna plot new data, the axis the smaller and smaller by each time i type the plot command
just try this:
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy');
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy');
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy');
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy');
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy');
scrollplot(plot([-10:0.01:10]',sin([-10:0.01:10]')),'axis','xy');

14 May 2009 Yair Altman

Rene - ScrollPlot is not a replacement for the plot function - it works on existing plots, within the current boundaries of the axes, so of course the new axes gets smaller to leave room for the scrollbars. This is exactly how it is supposed to work.

If you want to update the plot data, don't call plot again and again - instead, update the data of the plot handle.

Next time, make sure to read the documentation and understand the usage before you post a review... Others might say RTFM, but I say that considering that this minor issue made you think ScrollPlot only merits a mediocre rating, means that you have an exceptionally developed sense of quality perfection. I therefore look forward to learning from your would-be superior submissions here on the File Exchange.

08 Jun 2009 joe saucer

Yair, i have a string of data and i want to look at it very close up.. and also want to scroll, but because of the close up specifications, i cant scroll because i cant get the mid blue pane

28 Aug 2009 Tim

A version that would link scrolling across subplots would be very cool.

09 Sep 2009 almog shalom

Nice.
One comment:
When I try it, MATLAB prouce the following warning:

Warning: figure JavaFrame property will be obsoleted in a future release. For more information see
the JavaFrame resource on the MathWorks Web site.

(with a link to http://www.mathworks.com/support/contact_us/dev/javaframe.html )

11 Sep 2009 Yair Altman

Almog - The warnings can be eliminated by typing:

warning off MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame

I'll add it to a new version when I get to it, but in the meantime you can simply add this to your startup.m file or your Matlab Command Window. It has no negative effect.

אשמח אם תוכל להקדיש רגע להזין רייטינג :-)

17 Sep 2009 almog shalom

Forgot the rating ...

11 Oct 2009 leo zao  
11 Oct 2009 leo zao

Hello!
Thanks a lot for this really nice and useful function!
I tried it with a time series and unfortunately the axes of the scrollplot part don't seem to "react" to the function "datetick". (It labels the tick lines of an axis using dates, replacing the default numeric labels)
I am a beginner with matlab and if someone know how to deal using dates with the function scrollplot, I would be very grateful!
Thanks a lot!
Leo

Please login to add a comment or rating.
Updates
16 May 2007

Set focus on parent axes after scroll-axes creation; added special scroll props; allowed 'Axis'='xy'

16 May 2007

Added 'MinX' etc. params; clarified error msgs; fixed 'xy' bugs; added 'ParentAxesHandle' special prop

15 Jun 2007

Enabled image exploration per suggestion by Joe Lotz; improved log axis-scaling behavior per suggestion by Fredric Moisy; added scroll visibility & deletion handlers; fixed minor error handling bug

Tag Activity for this File
Tag Applied By Date/Time
data exploration Yair Altman 22 Oct 2008 09:12:38
scroll plot axes Yair Altman 22 Oct 2008 09:12:38
scroll sub window Yair Altman 22 Oct 2008 09:12:38
plot Yair Altman 22 Oct 2008 09:12:38
image exploration Yair Altman 22 Oct 2008 09:12:38
axes Yair Altman 22 Oct 2008 09:12:38
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com