我对 gnuplot 非常缺乏经验。我正在使用此网站上的演示:http://gnuplot.sourceforge.net/demo/heatmaps.html
我设法获得了热图:
set title "Heat Map"
unset key
set tic scale 0
set palette rgbformula 30,31,32
set cbrange [0:40]
set cblabel "Compactness"
unset cbtics
set xrange [-0.5:105.5]
set yrange [-0.5:27.5]
set view map
set terminal gif
set output "heatmap.gif"
splot '-' matrix with image
但正如示例中所示,这会生成矩形。如何制作 gnuplot 绘制二次场/像素/点?
最佳答案
无需使用 splot
来绘制热图。只需使用plot ... with image
即可。对于 2D 绘图,您可以使用设置大小比例 -1
使两个轴上具有相同的单位。
考虑测试数据文件test.dat
:
1 2 3 4 3 4 5 6 7
4 5 6 3 9 8 2 9 4
使用最少的脚本
set terminal pngcairo
set output 'test.png'
set autoscale fix
set size ratio -1
set palette rgbformulae 30,31,32
plot 'test.dat' matrix with image
你得到结果(使用4.6.3):
关于Gnuplot - 如何用二次场绘制热图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22288641/