You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
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".
Cite As
Sebastian Hölz (2026). plotLDS (https://www.mathworks.com/matlabcentral/fileexchange/18857-plotlds), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0.0 (8.23 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.1.0.0 | Revision 33:
|
||
| 1.0.0.0 | Fixed several bugs.
|
