Gnuplot - 如何用二次场绘制热图

标签 gnuplot heatmap

我对 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):

enter image description here

关于Gnuplot - 如何用二次场绘制热图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22288641/

相关文章:

Gnuplot 更改直方图中条的颜色

python - 根据聚类按行划分seaborn矩阵

Bash - 使用临时文件夹中的文件

javascript - Gnuplot Canvas : tics disappear on zoom

gnuplot - gnuplot 中同一个图上有多个拟合线?

google-maps - 如何将HeatMaps添加到Flutter Mobile应用程序

google-maps - 创建美国动态热图的最简单方法

javascript - 如何根据预先确定的约束值自定义热图颜色?

r - 具有不同颜色和比例 R 的两个对称矩阵上的单个热图

object - 无边框线的 Gnuplot png 文件