我正在尝试使用 gnu plot 生成热图。
set title "Heat Map"
plot '-' matrix with image
10 20 30 40 50 60 70 80 90 100
20 30 40 50 60 70 80 90 100 0
30 40 50 60 70 80 90 100 0 0
40 50 60 70 80 90 100 0 0 0
50 60 70 80 90 100 0 0 0 0
60 70 80 90 100 0 0 0 0 0
70 80 90 100 0 0 0 0 0 0
80 90 100 0 0 0 0 0 0 0
90 100 0 0 0 0 0 0 0 0
100 0 0 0 0 0 0 0 0 0
e
沿着轴,我得到值 -2 0 2 4 6 8 10,我想用自定义字符串替换它们。我不知道如何做到这一点。
答案1
尝试这个解决方案:
set border 0 # remove box around map
set xtics ("first" 0, "sec." 2, "last" 9) # set special strings on selected position on x axes
set ytics ("first" 0, "sec." 2, "last" 9) # set special strings on selected position on y axes
unset key # without key
set title "Heat Map"
plot '-' matrix with image
10 20 30 40 50 60 70 80 90 100
20 30 40 50 60 70 80 90 100 0
30 40 50 60 70 80 90 100 0 0
40 50 60 70 80 90 100 0 0 0
50 60 70 80 90 100 0 0 0 0
60 70 80 90 100 0 0 0 0 0
70 80 90 100 0 0 0 0 0 0
80 90 100 0 0 0 0 0 0 0
90 100 0 0 0 0 0 0 0 0
100 0 0 0 0 0 0 0 0 0
e