gnuplot:数据表类型值=';u';和直方图框中的奇怪条
我以前问过这个问题。这是一个相关的问题 使用gnuplot:数据表类型值=';u';和直方图框中的奇怪条,gnuplot,Gnuplot,我以前问过这个问题。这是一个相关的问题 使用test.txt文件: -0.1 0 0 JANE 1 1 1 BILL 2 2 1 BILL 1 3 1 BILL 6 4 0 JANE 35 5 0 JANE 9 6 1 BILL 4 7 1 BILL 24 8 1 BILL 28 9 1 BILL 9 10 0 JANE 16 11 1 BILL 4 12 0 JANE 45 13 1 BILL 以及Gnuplot脚本:
test.txt
文件:
-0.1 0 0 JANE
1 1 1 BILL
2 2 1 BILL
1 3 1 BILL
6 4 0 JANE
35 5 0 JANE
9 6 1 BILL
4 7 1 BILL
24 8 1 BILL
28 9 1 BILL
9 10 0 JANE
16 11 1 BILL
4 12 0 JANE
45 13 1 BILL
以及Gnuplot脚本:
file='test.txt'
binwidth=10
bin(x,width)=width*floor(x/width)
set table "data_table"
plot file using (bin($1,binwidth)):(1.0) smooth freq,\
file using (1+(bin($2,binwidth))):(1.0) smooth freq
unset table
set boxwidth 1
set logscale y
set yrange[0.01:15]
plot "data_table" index 0 using ($1):($2 == 0 ? 1/0 : $2) with boxes,\
"data_table" index 1 using ($1):($2 == 0 ? 1/0 : $2) with boxes
我得到数据\u表
:
# Curve 0 of 2, 7 points
# Curve title: "file using (bin($1,binwidth)):(1.0)"
# x y type
-10 1 i
0 8 i
10 1 i
20 2 i
30 1 i
40 1 i
0 1 u
# Curve 1 of 2, 3 points
# Curve title: "file using (1+(bin($2,binwidth))):(1.0)"
# x y type
1 10 i
11 4 i
1 1 u
根据Gnuplot shell中的“帮助设置表”:
“…字符R具有以下三个值之一:
如果点在活动范围内,则为“i”,如果超出范围,则为“o”,或者为“u”
如果没有定义。”
问题1:为什么数据表
中每个索引组的最后一行的值为u
,为什么它的x
值似乎有问题
问题2:生成的绘图与。如果你查看在(x=0,y=1)的容器,你会注意到直方图框中间的一个条。它是什么?我该如何摆脱它
u
标记为未定义的多余点是由错误引起的,请参阅u
的点:file='test.txt'
binwidth=10
bin(x,width)=width*floor(x/width)
set table "data_table"
plot file using (bin($1,binwidth)):(1.0) smooth freq,\
file using (1+(bin($2,binwidth))):(1.0) smooth freq
unset table
set boxwidth 1
set logscale y
set yrange[0.01:15]
unset key
plot "data_table" index 0 using ($1):($2 == 0 || strcol(3) eq "u" ? 1/0 : $2) with boxes,\
"data_table" index 1 using ($1):($2 == 0 || strcol(3) eq "u" ? 1/0 : $2) with boxes