2015-04-23 190 views
1

我有數據是這樣的:如何使用數據作爲gnuplot的傳奇之列呢?

# c1 c2 c3 
23 b 323 
23 g 54 
23 a 11 
23 c 1 
23 d 0 
23 e 397 
23 f 40 
24 b 23 
24 g 24 
24 a 113 
24 c 12 
24 d 10 
24 e 7 
24 f 50 

我需要c1至繪製在x軸(23,24),C3上的y軸爲C2即不同的值,多​​個圖形具有不同的顏色c2的每個值。

enter image description here

回答

2

一般情況下,你必須做過濾的gnuplot之外,爲了有連接點的過濾線。

如果你知道它可以出現在第二列的所有值,你可以使用Plotting multiple graphs depending on column value with gnuplot給出的解決方案。

如果你不知道的可能值,你可以用

c2s = system("awk '!/^#/ { print $2 }' test.dat | sort | uniq") 

提取出來,然後用

plot for [c2 in c2s] sprintf('< grep ''\b%s\b'' test.dat', c2) using 1:3 with lines title c2 

enter image description here

+0

@Chirstoph嗨繪製出來,我們怎樣才能genrate historgram從類似的數據?? –

+0

這要看你的實際柱狀圖應該像(堆疊,集羣等),建議最好提出新問題,並說明你到底想實現什麼,是你有stucked。 – Christoph

相關問題