要绘制标签,只需使用with labels
绘图样式.您可以使用任何字符串和字符串格式,例如sprintf
用来设置标签:
reset
set autoscale fix
set palette defined (0 'white', 1 'green')
set tics scale 0
unset cbtics
set cblabel 'Score'
unset key
plot 'data.txt' matrix with image,\
'' matrix using 1:2:(sprintf('%.2f', $3)) with labels font ',16'
Run Code Online (Sandbox Code Playgroud)
pngcairo
终端和gnuplot 4.6.3 的结果是:
data.txt
此示例的数据文件是:
0.22 0.13 0.54 0.83 0.08
0.98 0.57 0.52 0.24 0.66
0.23 0.68 0.24 0.89 0.76
0.89 0.78 0.69 0.78 0.10
0.24 0.77 0.27 0.28 0.69
Run Code Online (Sandbox Code Playgroud)