我有一個像下面的數據文件:是否可以在gnuplot中每十行繪製一行?
#X1 y1 x2 y2 Number
123 567 798 900 1
788 900 87 89 2
....
,我使用下面的命令
plot '~/Desktop/pointcolor.txt' using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle
這裏是結果得出我的圖表。
正如你可以在上面的圖片查看,結果是壓縮的,所以我想每個具有在數據文件中相同數量的十行畫一條線。
EDIT1:
我嘗試@ewcz解決方案,如下:
stat="0 0 0 0 0 0 0" # How should I define array as [gnuplot][2] didn't support it?
plot "< awk '{if(((stat[$5]++)%10==0)) print}'~/Desktop/pointt.txt" using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle
,但我得到這個錯誤:
gnuplot> load "gnuplot.cmd"
awk: line 1: syntax error at or near
gnuplot> plot "< awk '{if(((stat[$5]++)%10==0)) print}'~/Desktop/pointcolor.txt" using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle
^
"gnuplot.cmd", line 6: warning: Skipping data file with no valid points
gnuplot> plot "< awk '{if(((stat[$5]++)%10==0)) print}'~/Desktop/pointcolor.txt" using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle
^
"gnuplot.cmd", line 6: x range is invalid
EDIT2:
的解決方案:
plot "< awk '{if((stat[$5]++)%10==0) print}' ~/Desktop/pointt.txt" using 1:2:($3-$1):($4-$2):5 with vectors palette nohead notitle
這些鏈接使用'every'選項根據行號來畫線,在我的情況下如何使用這個選項? – user3806649
'stat'數組在內部調用'(g)awk',不需要'stat =「0 0 0 0 0 0」'行。另外,'〜'字符前面應該有一個空格,以便'awk'可以區分用撇號括起來的命令和正在處理的文件'〜/ Desktop/pointcolor.txt' – ewcz
我仍然得到一個錯誤:( – user3806649