【发布时间】:2021-07-13 15:06:28
【问题描述】:
我想用 Gnuplot 绘制一个直方图,我有以下代码:
n=100 #number of intervals
max=31 #max value
min=22 #min value
width=(max-min)/n #interval width
#function used to map a value to the intervals
hist(x,width)=width*floor(x/width)+width/2.0
GNUTERM = "x11"
set terminal postscript enhanced color
set output "histo.ps"
plot "file_log" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb "blue" notitle
通常这段代码运行良好,但现在我得到了一个
"histo.gnu", line 48: warning: Skipping data file with no valid points
plot "file_log" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb "blue" notitle
^
"histo.gnu", line 48: x range is invalid
我真的不明白为什么,因为文件中的值确实在 22 到 31 之间……知道吗?
【问题讨论】:
-
错误行似乎不是第 48 行。您是否还有一些未显示的代码?如果您在开头添加
reset或reset session可能会有所帮助吗? -
是的,但我认为这些行不相关......第 48 行对应于以“Plot”开头的行。我试过
reset但它没有改变,reset session给了我"histo.gnu", line 13: warning: expected optional axis name