2016-07-12 1 views
1

以下の "option-1" plotコマンドで凡例を自動的に生成する方法を知りたいと思います。 3つの曲線が得られるが、唯一の凡例名、すなわち「Y0」のみが現れる。すべてのデータセットのgnuplot自動凡例生成

"option-2"を使用すると、すべての凡例名を取得できますが、大きなデータセットの場合はこの方法が嫌いです。プロットファイルの

CONTENTS: "データセット" ファイルの


set key autotitle columnhead 

#option-1 
plot "dataset" skip 1 index 0:2:1 using 1:2:(1+column(-2)) title\ 
    columnhead with linespoints linecolor variable 

#option-2 
plot "dataset" skip 1 index 0 using 1:2 title columnhead with linespoints,\ 
    "" skip 1 index 1 using 1:2 title columnhead with linespoints,\ 
    "" skip 1 index 2 using 1:2 title columnhead with linespoints 

CONTENTS:


テキストファイル

#index_0 
X0  Y0 
0  1 
1  2 
2  3 
3  4 


#index_1 
X1  Y1 
0  2 
1  3 
2  4 
3  5 


#index_2 
X2  Y2 
0   3 
1   4 
2   5 
3   6 

答えて

1

あなたのオプション-1を硬化させるために、しかし、あなたはforループを使用して大規模なデータセットのためのオプション-2自動化できる方法がわからない:

N=2 # last index 
plot for [i=0:N] "dataset" skip 1 index i using 1:2 title columnhead with linespoints 
+0

おかげJoce!それは大きな助けとなりました。 – Jun

関連する問題