有這個沒辦法,你需要擺弄了一下。這裏是YAGH(另一個gnuplot破解);)
假設您的值是等距分隔的,您可以使用'+'
特殊文件名和labels
繪圖樣式。
只顯示自定義鍵,請看下面的例子:
labels="first second third fourth"
set xrange[0:1] # must be set for '+'
set yrange[0:1]
set samples words(labels) # number of colors to use
key_x = 0.8 # x-value of the points, must be given in units of the x-axis
key_y = 0.8
key_dy = 0.05
set palette model RGB defined (1 'black', 2 'blue', 3 'green', 4 'red')
unset colorbox
plot '+' using (key_x):(key_y + $0*key_dy):(word(labels, int($0+1))):0 \
with labels left offset 1,-0.1 point pt 7 palette t ''
這給(與4.6.4):
由於set samples
不影響數據圖,您可以在繪圖命令直接集成這樣的:
...
unset key
plot "file" u 2:1:3 w points pt 14 ps 2 palette, \
"file2" u 2:1:3 w points pt 14 ps 2 palette, \
'+' using (key_x):(key_y - $0*key_dy):(word(labels, int($0+1))):0 \
with labels left offset 1,-0.1 point pt 14 ps 2 palette
但是你需要設置一個適當的xrange,yrange和key_x
,key_y
和key_dy
值。
這還不是最直觀的方式,但它的工作原理:)
通常'colorbox',你不設置,是爲這個。 – Christoph
你是什麼意思?我根本不是專家=) – Nikko
從您的腳本中刪除'unset colorbox'部分,您將獲得顏色關聯值<->。或者你只有幾個顏色值,每種顏色都有不同的含義? – Christoph