Gnuplot: matrix scale axis

I have a matrix output.dat:

0   0   0   0   0   0   3   7   1   0   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   11  16  6   1   0   0   0   0   0   0   0   0   0
0   0   0   0   0   7   8   4   16  4   1   0   0   0   0   0   0   0   0   0
0   0   0   0   0   2   2   5   11  3   1   0   0   0   0   0   0   0   0   0
0   0   0   0   0   3   1   9   10  9   0   0   0   0   0   0   0   0   0   0
0   0   0   0   0   12  28  13  11  5   0   0   0   0   0   0   0   0   0   0
0   0   0   0   1   6   17  33  14  2   0   5   2   0   0   0   0   0   0   0
0   0   0   0   0   1   13  15  11  6   0   0   5   7   0   0   0   0   0   0
0   0   0   0   0   0   3   3   8   3   0   0   0   3   0   0   0   0   0   0
0   0   0   0   0   0   0   8   8   8   1   2   1   3   2   0   0   0   0   0
0   0   0   0   0   0   0   1   17  10  4   7   4   12  3   0   0   0   0   0
0   0   0   0   0   3   2   3   6   22  9   5   8   5   1   0   0   0   0   0
0   0   0   0   0   1   5   7   10  35  4   6   6   9   4   0   0   0   0   0
0   0   0   0   0   2   12  12  30  52  23  11  8   7   5   1   0   0   0   0
0   0   0   0   1   7   25  16  33  30  26  16  21  19  5   2   0   0   0   0
0   0   0   0   0   0   12  36  19  22  28  19  30  17  9   0   0   0   0   0
0   0   0   0   0   11  18  12  37  32  27  26  33  21  10  12  3   0   0   0
0   0   0   0   0   11  14  23  44  59  45  26  28  9   3   7   0   0   0   0
0   0   0   0   0   0   0   8   19  23  22  11  34  32  25  7   0   0   0   0
0   0   0   0   0   0   0   0   4   8   9   16  21  26  20  11  12  4   6   2

      

Using this in a bash script produces a perfectly fine matrix plot:

echo "set terminal png font arial 30 size 1600,1200;
set output 'output.png';set xrange [1:20];set yrange [1:20];set xlabel 'x';set ylabel 'y';
set pm3d map;set pm3d interpolate 0,0;splot 'output.dat' matrix" | gnuplot

      

However, I would like the x-axis and y-axis to say "0 ... 1" instead of "1 ... 20". If I just change the value xrange [1:20]

to [0:1]

, no data is displayed. And data scaling doesn't work. The use xticlabels

(at least as far as I understand) did not change the axes either.

How can I change x and y to say "0 ... 1" instead of "1 ... 20"?

+3


source to share


1 answer


I don't know what you tried, but scaling in expression using

works great:

echo "set terminal pngcairo;set autoscale fix; set tics out nomirror; 
      set xlabel 'x';set ylabel 'y'; set pm3d map interpolate 0,0; 
      splot 'output.dat' matrix using (\$1/19.0):(\$2/19.0):3" | gnuplot > output.png

      



enter image description here

+5


source







All Articles