Be the first to rate this file! 193 downloads (last 30 days) File Size: 9.11 KB File ID: #18857

plotLDS

by Sebastian Hölz

 

20 Feb 2008 (Updated 21 Jan 2009)

Code covered by BSD License  

Enhance zooming and panning on large data sets by automatically downsampling data

Download Now | Watch this File

File Information
Description

DESCRIPTION
===========
Function for plotting large data sets (e.g. time-series with more than 1e6 data points).
The main benefit of this function can be seen in the fact that zooming and paning will work much smoother,
since the data is automatically downsampled to 1e4 points (=> change "n_points" for different number).

USAGE
=====
The usage is exactly identical to the regular plot-command, i.e.:

      plotLDS(x,y,'r')

HINTS & LIMITATIONS
===================

Will only work in Matlab 7.3 or higher.

"DeleteFcn" & "CreateFcn" are used for plotted line and should not be overwritten.
The "ActionPostCallback" (=> zoom & pan) is also used and cannot be used otherwise in the according plots / figures.

Downsampling is simply performed by plotting only every n-th data point. Therefore, aliasing may occur !!!

Data is clipped outside current axislimits and is updated to the current axis-limits after panning / zooming is finished.

Using double-clicking in "zoom-in" modus might not work as expected, because the dispayed data-set
is clipped. It is possible to return to the original data-set by using the scroll-wheel or the "zoom-out" tool.

The x- & y-data is stored as application-data to the plot-handle.

To get the true x- and y-data for the line with handle h, use ...
  x = getappdata(h,'LDS_xdata');
  y = getappdata(h,'LDS_ydata');

EXAMPLES (Use zoom & pan; compare to regular plot-command !!!
========
plotLDS(sin(1e4*(0:1e6)))

phi = linspace(0,2*pi,1e6); plotLDS(sin(x),cos(x),'.')

ax(1) = subplot(2,1,1); plotLDS(rand(1e6,1))
ax(2) = subplot(2,1,2); plotLDS(rand(1e6,1))
linkaxes(ax,'x')

plotLDS(rand(1e6,1)); ax(1)=gca; figure; plotLDS(rand(1e6,1)); linkaxes(ax,'x'); ax(2)=gca; linkaxes(ax,'x')

Acknowledgment
==============
Jiro Doke informed me that his submission "DSPLOT", which was chosen as "Pick of the Week", performs a similar task as this submission. I did not notice before and of course he should be acknowledged.

I did a quick comparison on the two submissions and noticed the following differences:
1) plotLDS is not restriced to single figures / axes but will work for arbitrary combinations. Most important: it will also work for linked axes !!!
2) plotLDS is not restricted to plots with monotonically increasing x-data, but will also handle plots with monotonically increasing y-data and plots with unstructured data (e.g. point-clouds).
3) plotLDS uses exactly the same syntax as the regular "plot"-command. This facilitates the use of this command by simply replacing "plot" by "plotLDS" without having to care for input-arguments.
3) Jiro's submission (DSPLOT) includes a more advanced way of investigating the data to make sure it doesn't miss any "outliers".

MATLAB release MATLAB 7.3 (R2006b)
Zip File Content  
Other Files CallbackStack.m,
plotLDS.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
20 Feb 2008 Jiro Doke

Hi Sebastian,
Just wanted to let you know I also created a similar function:

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15850&objectType=file

Please login to add a comment or rating.
Updates
22 Feb 2008

V1.1 (22.02.08): Works for all plotting-syntaxes, monotonically increasing y-data, unstructured data, and for saving and reloading a figure.

V1.0 (20.02.2008): First release

25 Jun 2008

Fixed several bugs.
It is now possible to directly link plotted data to the base workspace: plotLDS(y,'ydatasource','y'). This greatly reduces the memory need.

21 Jan 2009

Revision 33:
- plotLDS now relies on "CallbackStack", which is supplied together with this file.
- New switches.
- Input style for switches changed slightly.
- Bug-fixes.

Tag Activity for this File
Tag Applied By Date/Time
data exploration Sebastian Hölz 22 Oct 2008 09:49:59
plot Sebastian Hölz 22 Oct 2008 09:49:59
large Sebastian Hölz 22 Oct 2008 09:49:59
timeseries Sebastian Hölz 22 Oct 2008 09:49:59
set Sebastian Hölz 22 Oct 2008 09:49:59
data Sebastian Hölz 22 Oct 2008 09:49:59
data exploration Dan Kominsky 01 Dec 2008 17:20:35
 

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