使用gnuplot的直方图? [英] Histogram using gnuplot?

查看:84
本文介绍了使用gnuplot的直方图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的.dat文件已经具有正确的装箱数据,我知道如何在gnuplot中创建直方图(只需使用"with box").有没有办法获取数字列表并让gnuplot根据用户提供的范围和容器大小提供直方图?

I know how to create a histogram (just use "with boxes") in gnuplot if my .dat file already has properly binned data. Is there a way to take a list of numbers and have gnuplot provide a histogram based on ranges and bin sizes the user provides?

推荐答案

是的,它虽然既隐藏又快速简单:

yes, and its quick and simple though very hidden:

binwidth=5
bin(x,width)=width*floor(x/width)

plot 'datafile' using (bin($1,binwidth)):(1.0) smooth freq with boxes

签出help smooth freq,看看为什么上面的方法会产生直方图

check out help smooth freq to see why the above makes a histogram

要处理范围,只需设置xrange变量即可.

to deal with ranges just set the xrange variable.

这篇关于使用gnuplot的直方图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆