Ace*_*man 3 plot gnuplot histogram width bin
我使用直方图没有成功.一个简单的问题是使用以下数据:
age range - frequency - central band width - bin width - height (respectively)
1-4 - 30 - 2.5 - 3 - 10
5-6 - 20 - 5.5 - 1 - 20
7-17 - 30 - 12 - 10 - 3
Run Code Online (Sandbox Code Playgroud)
随着沿X轴的年龄,具有线性刻度,因此1-4的箱宽度将为3,高度为10,5-6的箱宽度为1,高度为20,而7-17为10且高度为3.
如何将这些数据放入Word /记事本文档.dat文件中?然后我如何使用它们来设置直方图gnuplot?
我会使用以下数据文件格式(仅使用空格来分隔字段):
"age range" "frequency" "central band width" "bin width" "height"
1-4 30 2.5 3 10
5-6 20 5.5 1 20
7-17 30 12 10 3
Run Code Online (Sandbox Code Playgroud)
boxes绘图,请使用绘图样式.这允许您使用列中的值作为宽度.xtic(1)你使用的第一列xticlabel的条目.所以一个相当简单的绘图脚本如下所示:
set style fill solid noborder
set yrange [0:*]
set offset 1,1,1,0
plot 'file.txt' using 3:5:4:xtic(1) with boxes notitle
Run Code Online (Sandbox Code Playgroud)
版本4.6.3和pngcairo终端的结果是:
