Matrix 使用gnuplot以不同颜色打印矩阵非数字点

Matrix 使用gnuplot以不同颜色打印矩阵非数字点,matrix,gnuplot,Matrix,Gnuplot,我有一个文件'matrix.dat'如下所示: 10584 179888 115816 16768 91440 79928 50656 23624 21712 51776 89670 21815 13536 18984 11997 16221 10336 432 632 2024------408--B--B--B--17600 11632 1008 4384 144--216 72--768 336--384--408 5312--72 3648---—————————————————————

我有一个文件
'matrix.dat'
如下所示:

10584 179888 115816 16768 91440 79928 50656 23624 21712 51776 89670 21815 13536 18984 11997 16221 10336 432 632 2024------408--B--B--B--17600 11632 1008 4384 144--216 72--768 336--384--408 5312--72 3648---—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

我想使用调色板绘制数字,'-'使用白色,'B'使用黑色。
在gnuplot中,我使用
log2调色板
(蓝色->青色->绿色->橙色->红色),并将
'-'
设置为缺少的数据:

set palette model HSV functions 0.666*(1-gray), 1, 1
set logscale cb 2
set datafile missing "-"
plot 'matrix.dat' matrix with image

现在我只能以所需的颜色绘制数字和
'-'
。如何以黑色打印
'B'

我用分段函数解决了这个问题。只是一个小小的变化:

set palette model HSV functions gray>0 ? 0.666*(1-gray):0, 1, gray>0 ? 1:0
然后将文件的所有
'B'
更改为
'0'
。其思想是对
0
使用黑色,对非零值使用调色板中的颜色。谢谢