计算 gnuplot 中绘制点的数量
Counting number of plotted points in gnuplot
数据文件包含以下格式的值:
0 0 50
0 1 70
1 0 40
1 1 70
2 0 110
2 1 60
3 0 60
3 1 120
4 0 50
4 1 50
5 0 70
5 1 70
这是我的 gnuplot 脚本中的代码片段:
plot 'file' using ( > 100 && == 0 ? : 1/0): 3 with points pointtype 1,\
'file' using ( > 100 && == 1 ? : 1/0): 3 with points pointtype 2
有人可以建议一种方法来计算每个点类型的标绘点数吗?
这通过设置计数器相对容易做到,然后在满足您的条件时执行counter = counter + 1
(为了紧凑我删除了样式):
minval = 100; count1 = 0; count2 = 0
plot 'file' using ( > minval && == 0 ? (count1 = count1 + 1, ) : 1/0):3, \
'file' using ( > minval && == 1 ? (count2 = count2 + 1, ) : 1/0):3
gnuplot> print count1, count2
1 1
minval = 50; count1 = 0; count2 = 0
plot 'file' using ( > minval && == 0 ? (count1 = count1 + 1, ) : 1/0):3, \
'file' using ( > minval && == 1 ? (count2 = count2 + 1, ) : 1/0):3
gnuplot> print count1, count2
3 5
数据文件包含以下格式的值:
0 0 50
0 1 70
1 0 40
1 1 70
2 0 110
2 1 60
3 0 60
3 1 120
4 0 50
4 1 50
5 0 70
5 1 70
这是我的 gnuplot 脚本中的代码片段:
plot 'file' using ( > 100 && == 0 ? : 1/0): 3 with points pointtype 1,\
'file' using ( > 100 && == 1 ? : 1/0): 3 with points pointtype 2
有人可以建议一种方法来计算每个点类型的标绘点数吗?
这通过设置计数器相对容易做到,然后在满足您的条件时执行counter = counter + 1
(为了紧凑我删除了样式):
minval = 100; count1 = 0; count2 = 0
plot 'file' using ( > minval && == 0 ? (count1 = count1 + 1, ) : 1/0):3, \
'file' using ( > minval && == 1 ? (count2 = count2 + 1, ) : 1/0):3
gnuplot> print count1, count2
1 1
minval = 50; count1 = 0; count2 = 0
plot 'file' using ( > minval && == 0 ? (count1 = count1 + 1, ) : 1/0):3, \
'file' using ( > minval && == 1 ? (count2 = count2 + 1, ) : 1/0):3
gnuplot> print count1, count2
3 5