user2742907
user2742907

Reputation: 87

GNUPlot heatmap from text file matrix

I have a large matrix (4900 x 64), stored in a text file, that I would like to plot as a heatmap. The output image should be the dB level of each matrix element, mapped to whichever colour scale. The dB conversion is done before outputting the text file, so I only need to plot the heatmap.

I understand the very basic level of plotting 2-D data with gnuplot, I just can't seem to get the correct output when plotting the heatmap with pm3d / with image: (edit)

set terminal epscairo
set output '~/out.eps'
set palette defined (0 0 0 0.5, 1 0 0 1, 2 0 0.5 1, 3 0 1 1, 4 0.5 1 0.5, 5 1 1 0, 6 1 0.5 0, 7 1 0 0, 8 0.5 0 0) 
plot '~/Documents/MATLAB/range_doppler_out.txt' with image

Thanks in advance.

Upvotes: 0

Views: 1615

Answers (1)

Christoph
Christoph

Reputation: 48440

If your data file is arranged like a matrix:

z00 z01 z02 z03 ...
z10 z11 z12 z13 ...
z20 z21 z22 z22 ...
...

then you must specify the matrix option when plotting:

plot 'file' matrix with image

Upvotes: 2

Related Questions