使用gnuplot绘制具有不同颜色的每个子序列

时间:2017-09-01 15:29:01

标签: gnuplot

我按升序排列了105个排序值。我将该列表分为5个子序列,如下表所示:

static <T> Predicate<T> once(Predicate<T> predicate){
   AtomicInteger seen = new AtomicInteger(0);

   return it -> {
     //if seen==0 then test predicate, otherwise increment only 
     IntBinaryOperator accumulator = (x,y)-> x==0 && predicate.test(it) ? x : x+y;
     return seen.accumulateAndGet(1, accumulator) != 1; 
   };
}
  

我的问题是如何连续绘制所有5个子序列   方式,每个都有不同的颜色。我使用了以下脚本。但   问题是它正在单独绘制它们,如图所示   下图。

enter image description here

id  Seq1    Seq2    Seq3    Seq4    Seq5
1   696.99  958.79  989.02  1018.28 1078.3
2   869.21  959.26  989.02  1018.28 1078.3
3   898.73  959.44  989.02  1018.28 1078.55
4   898.73  959.44  989.02  1018.28 1078.55
5   898.73  959.44  989.21  1018.28 1078.55
6   898.73  959.44  989.21  1018.28 1078.55
7   898.73  959.44  989.21  1018.28 1078.55
8   898.79  959.44  989.21  1018.52 1078.69
9   898.79  959.51  989.21  1018.52 1078.69
10  898.79  959.51  989.21  1018.52 1078.69
11  899.27  988.52  989.26  1018.52 1078.69
12  899.27  988.65  989.26  1018.52 1078.69
13  899.27  988.65  989.26  1018.52 1078.69
14  899.44  988.65  989.26  1019.0  1078.73
15  928.65  988.65  989.51  1019.0  1078.73
16  928.73  989.0   989.51  1019.26 1078.73
17  929.26  989.0   989.51  1078.3  1078.73
18  958.73  989.0   989.51  1078.3  1078.73
19  958.79  989.02  989.51  1078.3  1078.73
29  958.79  989.02  1013.0  1078.3  1144.2
21  958.79  989.02  1013.0  1078.3  1144.21

2 个答案:

答案 0 :(得分:2)

从此answer我将您的数据更改为两列:

1   696.99
2   869.21
3   898.73
4   898.73
5   898.73
6   898.73
7   898.73
8   898.79
9   898.79
10  898.79
11  899.27
12  899.27
13  899.27
14  899.44
15  928.65
16  928.73
17  929.26
18  958.73
19  958.79
20  958.79
21  958.79


22  958.79
23  959.26
24  959.44
25  959.44
26  959.44
27  959.44
28  959.44
29  959.44
30  959.51
31  959.51
32  988.52
33  988.65
34  988.65
35  988.65
36  988.65
37  989
38  989
39  989
40  989.02
41  989.02
42  989.02


43  989.02
44  989.02
45  989.02
46  989.02
47  989.21
48  989.21
49  989.21
50  989.21
51  989.21
52  989.21
53  989.26
54  989.26
55  989.26
56  989.26
57  989.51
58  989.51
59  989.51
60  989.51
61  989.51
62  1013
63  1013


64  1018.28
65  1018.28
66  1018.28
67  1018.28
68  1018.28
69  1018.28
70  1018.28
71  1018.52
72  1018.52
73  1018.52
74  1018.52
75  1018.52
76  1018.52
77  1019
78  1019
79  1019.26
80  1078.3
81  1078.3
82  1078.3
83  1078.3
84  1078.3


85  1078.3
86  1078.3
87  1078.55
88  1078.55
89  1078.55
90  1078.55
91  1078.55
92  1078.69
93  1078.69
94  1078.69
95  1078.69
96  1078.69
97  1078.69
98  1078.73
99  1078.73
100 1078.73
101 1078.73
102 1078.73
103 1078.73
104 1144.2
105 1144.21

分为5组(每组之间有两个空行)。

然后这个:

plot for [IDX=0:4] 'prix.txt' index IDX u 1:2 with lp lt IDX+1

产生这个: enter image description here

答案 1 :(得分:2)

plot for [IDX=0:4] 'prix.txt' u ($1 + IDX*21):(column(IDX+2)) title columnhead(IDX+2) w lp

enter image description here

相关问题