2014-09-11 31 views
1

假設我有以下gnuplot腳本。Gnuplot linecolor調色板,但不是密鑰

set terminal epslatex standalone size 8cm, 4cm 
set output "test.tex" 
set palette defined (0 "black", 1 "red") 

plot \ 
    "a.dat" using 1:2:3 linecolor palette z pointtype 9 title "a" , \ 
    "b.dat" using 1:2:3 linecolor palette z pointtype 5 title "b" , \ 
    "c.dat" using 1:2:3 linecolor palette z pointtype 7 title "c" 

和下面的樣品數據集

a.dat

0 0 0 
1 0 1 
2 0 2 
3 0 3 
4 0 4 

b.dat

0 1 0 
1 1 1 
2 1 2 
3 1 3 

c.dat

0 2 0 
1 2 1 
2 2 2 

這給了我下面的

Sample picture

通過這個例子我的問題是,在傳說中的按鍵,都得到相應的輸入文件的最後一個數據點的顏色。基本上,我想讓鑰匙中的所有符號具有相同的顏色。我怎樣才能做到這一點?

我正在使用gnuplot 4.6.2(和4.6.5)。我正在尋找一個通用的解決方案。也就是說,我並不是在尋找一種解決方案,因爲我必須修改數據文件(因爲它定期更新)。

+0

@Christoph在我的完整用例中,「a」是正方形和「c」三角形。使用統一顏色的原因是因爲它很難看。 – Bernhard 2014-09-11 14:16:50

+1

啊,好的。感謝您的更新:) – Christoph 2014-09-11 14:20:04

回答

1

它進入我的腦海裏最好的選擇是,您可以指定實際上要在關鍵的顏色使用一個單獨的情節表達爲每個標題:

set terminal epslatex standalone size 8cm, 4cm 
set output "test.tex" 
set palette defined (0 "black", 1 "red") 

set key samplen 1 
set offset 0.1,0.1,0.1,0.1 

plot \ 
    "a.dat" using 1:2:3 palette pt 9 notitle, "" using 1:(NaN) lc rgb 'black' pt 9 title 'a', \ 
    "b.dat" using 1:2:3 palette pt 5 notitle, "" using 1:(NaN) lc rgb 'black' pt 5 title 'b', \ 
    "c.dat" using 1:2:3 palette pt 7 notitle, "" using 1:(NaN) lc rgb 'black' pt 7 title 'c' 

set output 
system('latex test && dvips test && ps2pdf test.ps') 

enter image description here

另外,您也可以用point選項手動設置三個標籤,但這可能需要更多的擺弄來獲得正確的位置和對齊。

+0

謝謝,這樣做是有道理的。 – Bernhard 2014-09-12 06:04:31