【发布时间】:2021-07-06 15:36:13
【问题描述】:
我正在尝试在 GnuPlot 中制作热图。这是数据:
我得到了这个数据布局:
...但我必须将 Y 轴值四舍五入到最接近的 5 以使它们适合网格的确切行。
所以我试图找出一个更 3D 的数据布局。我尝试过这样的事情:
X Y Z
1 69 3.9
2 44 5.2
3 39 2.6
4 51 5.1
5 50 2.2
6 47 2.5
7 52 2.1
8 52 2.6
9 52 4.0
...但出现“LU-DECOMP 中的奇异矩阵”错误。
我尝试在数据文件中为每个 Z 值做多行,但我不知道为空的 X 和 Y 位置放置什么。
这样布置数据文件的正确方法是什么?
为了完整起见,这是我的命令文件:
unset surface
unset key
set view map
set pm3d
set palette defined (0 'black', 1 'gray40', 2 'dark-green', 3 '#fee000', 4 '#fc7a00', 5 '#ff0000')
set cbrange [0:5]
set output 'temp.jpg'
set term jpeg size 900, 900 enhanced font '/Library/Fonts/Arial.ttf' 12 #000000 Effffff
set dgrid3d 400,400 splines
set size square
set xtics("" 1, "X Label 1" 2, "X Label 2" 3, "X Label 3" 4, "X Label 4" 5, "X Label 5" 6, "X Label 6" 7, "X Label 7" 8, "X Label 8" 9, "X Label 9" 10)
unset label
unset title
set title '{/=18 Title}' offset 0, .5
set ylabel '{/=18 Y Label}' offset -1.6, 0
set xlabel '{/=18 X Label}' offset 0,-3.0
set xtics out nomirror
set ytics out nomirror
set ytics("25" 0, "30" 1, "35" 2, "40" 3, "45" 4, "50" 5, "55" 6, "60" 7, "65" 8, "70" 9, "75" 10, "" 11)
set y2tics("25" 0, "30" 1, "35" 2, "40" 3, "45" 4, "50" 5, "55" 6, "60" 7, "65" 8, "70" 9, "75" 10, "" 11)
set xrange [0:11]
set yrange [0:11]
unset colorbox
set link x2; set link y2
splot [1:] '/gnuplot_data_test_v400.txt' matrix
replot
# http://hirophysics.com/gnuplot/gnuplot10.html
# https://stackoverflow.com/questions/17154364/gnuplot-pm3d-plot-triangle-data?rq=1
# https://askubuntu.com/questions/900501/i-cant-splot-with-pm3d-map-my-data-file-gnuplot
# http://lowrank.net/gnuplot/datafile-e.html#3dim
# http://psy.swansea.ac.uk/staff/carter/gnuplot/gnuplot_3d.htm
更新:这是我正在尝试制作的图表:
【问题讨论】: