我必須創建一個顏色映射,並且「與圖像」的繪圖樣式完全符合我的需求。 (繪製在位置x,y z的確切值,所以使用pm3d不是我的選項)Gnuplot:undefined/missing datapoints and plotting style'with image'
問題是,我的數據文件中有未定義的點。例如,函數表示質量比,因此負的z值沒有物理意義,我想省略它們。或者某些z值甚至是「NaN」。
示例數據文件:
1.0 1.0 1.5
1.0 2.0 1.7
1.0 3.0 1.9
2.0 1.0 1.6
2.0 2.0 1.8
2.0 3.0 2.0
3.0 1.0 1.7
3.0 2.0 1.9
3.0 3.0 -1.0
所以我不想繪製值-1的位置(3,3),但留下的(3,3)空白像素。
我嘗試這樣做:
plot './test.dat' u 1:2:($3>0 ? $3 : 1/0) with image
,但它不工作。它說:
警告:像素數不能被分解成整數匹配網格。 N = 8,K = 3
set datafile missing "NaN"
的情況下
該-1.0通過 「南」 替換也不起作用。
我發現的唯一的另一種方法是:
set pointsize 10
plot './test.dat' u 1:2:($3>0 ? $3 : 1/0) palette pt 5
但然後我必須手動調整爲每個情節的pointsize,x和y的範圍和情節的大小,所以不存在任何空格或重疊數據點。 (請參閱this question。)
因此,長話短說:有沒有什麼方法可以將「帶圖像」的繪圖樣式與未定義/缺失的數據點一起使用,並將這些點保留爲白色?
謝謝你的回答,這是一些東西;)在pngcairo終端看起來不錯(在cb底部沒有白點)。 – Regenbogenmaschine