Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot heat map with different scales

I have troubles creating a heat map with gnuplot for data with different scales.

Consider the following sample data set:

0.100    1.000     10.0
0.010    1.000     20.0
0.001    1.000     40.0

0.100    10.00     20.0
0.010    10.00     40.0
0.001    10.00     80.0

0.100    100.0     40.0
0.010    100.0     80.0
0.001    100.0    160.0

If I plot it using a heatmap, it only seems to be correct if I scale the x-values such that they are in the same range as the y-values.

Please find below an illustrating example. Only the second plot gives me the correct values of the heat map (high values in the top left corner, low values in the bottom right corner):

set multiplot layout 2,1

set pm3d
set dgrid3d 20,20
set view map

set xlabel 'unscaled'
splot 'data.dat' u 1:2:3

set xlabel 'scaled by factor 1000'
splot 'data.dat' u ($1*1000):2:3

How can I achieve this also for the non-scaled values?

Any help is appreciated. Many thanks.

like image 771
user31028 Avatar asked Jun 17 '26 20:06

user31028


1 Answers

Here you go :

set dgrid3d 20,20
set pm3d explicit
set view map

set table "interpolated_data.dat"

splot 'data.dat' using ($1*1000):2:3

set output 'heatmap.png'
set terminal pngcairo

set multiplot layout 2,1

unset table
unset dgrid3d
set pm3d
unset surface

set xlabel 'scaled by factor 1000'
splot 'interpolated_data.dat' u 1:2:3

set xlabel 'unscaled'
splot 'interpolated_data.dat' u ($1/1000):2:3
like image 103
Eric Duminil Avatar answered Jun 20 '26 09:06

Eric Duminil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!