Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting many lines as a heatmap

I have a large number (~1000) of files from a data logger that I am trying to process.

If I wanted to plot the trend from a single one of these log files I could do it using

plot(timevalues,datavalues)

I would like to be able to view all of these lines at same time in a similar way to how an oscilloscope has a "persistant" mode.

Oscilloscope Diplay

I can probably cobble together something that uses histograms but am hoping there is pre-existing or more elegant solution to this problem.

like image 687
Hugoagogo Avatar asked Apr 29 '14 05:04

Hugoagogo


1 Answers

You can do exactly what you are suggesting yourself, i.e. plotting the heatmap of the signals.

Consider the following: I'll build a test signals (out of sine waves of different amplitude), then I'll plot the heatmap via hist3 and imagesc.

The idea is to build an auxiliary signal which is just the juxtaposition of all your time histories (both in x and y), then extract basic bivariate statistics out of that.

 % # Test signals
 xx = 0 : .01 : 2* pi;
 center = 1;
 eps_ = .2;
 amps = linspace(center - eps_ , center + eps_ , 100 );

 % # the auxiliary signal will be stored in the following variables
 yy = [];
 xx_f = [];

 for A = amps
   xx_f = [xx_f,xx];
   yy = [yy A*sin(xx)];
 end 

 % # final heat map
 colormap(hot)
 [N,C] = hist3([xx_f' yy'],[100 100]);
 imagesc(C{1},C{2},N')

enter image description here

You can use also jet colormap instead of hot colormap for readability. In the following the amplitude is gaussian instead of homogeneus.

enter image description here

like image 171
Acorbe Avatar answered Oct 14 '22 14:10

Acorbe