Clear Filters
Clear Filters

Plotting beyond memory capabilities

2 views (last 30 days)
Kambren Rowlan
Kambren Rowlan on 27 Jul 2017
Answered: Steven Lord on 22 Sep 2017
I'm looking for a way to dynamically plot a large dataset.
It should be able to behave like this:
I plot 3 segments of the data with a window that views 1 of them, the window can be adjusted to view half of segment 2 and segment 3
when the view is moved far enough into segment 3 then the plot bounds will update and segment 1 will be throw out of memory and segment 4 added so that it will function the same but now will be looking further down the data.
Essentially I have more data than can comfortable fit in memory and I want to visualize it (not necessarily all at once) but not have to continually generate new plots. It is also important to be able to pretend like the separation of the data doesn't exist when viewing.

Answers (2)

KSSV
KSSV on 28 Jul 2017
Edited: KSSV on 28 Jul 2017
% some random data
x = rand(1000,1) ;
y = rand(1000,1) ;
z = rand(1000,1) ;
% reshape to plot them in small chunks
X = reshape(x,10,[]) ;
Y = reshape(y,10,[]) ;
Z = reshape(z,10,[]) ;
% 2D plot
h = plot(nan,nan,'r') ;
% 3D plot
% h = plot3(nan,nan,nan,'r') ;
% loop for each chunk
for i = 1:size(X,1)
% 3D
% set(h,'XData',X(:,i),'YData',Y(:,i),'ZData',Z(:,i)) ;
% axis([min(X(:,i)) max(X(:,i)) min(Y(:,i)) max(Y(:,i)) min(Z(:,i)) max(Z(:,i))])
% 2D
set(h,'XData',X(:,i),'YData',Y(:,i)) ;
axis([min(X(:,i)) max(X(:,i)) min(Y(:,i)) max(Y(:,i))])
drawnow
pause(0.1)
end

Steven Lord
Steven Lord on 22 Sep 2017
If you have data that is too large to fit in memory that you want to plot, see if you can update to release R2017b. We added support for tall arrays to the plot, scatter, and binscatter functions in that release.

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!