官术网_书友最值得收藏!

Making a basic histogram plot

This recipe shows you how to make the simplest step-type histogram. Later, we will build histogram and statistical plots on this, but sometimes this is all you need. The following figure shows a simple step-type histogram:

Making a basic histogram plot

Getting ready

We're going to plot a part of our file parabola.text, so make sure that's still available. Of course, if you have your own sorted statistical data that will probably be more interesting.

How to do it…

Type the following command to make a histogram plot:

plot [-2:2] 'parabola.text' with histeps

How it works…

As we can see, rather than drawing a line through a series of x-y points, the histeps style draws a staircase composed of horizontal and vertical line segments. The vertical lines are drawn not at the actual x-coordinates given in the data, but at the average values of neighboring x-coordinates. This is the usual way to construct a histogram, where each box represents "how much" is contained in each interval between two x-values.

主站蜘蛛池模板: 佛坪县| 武义县| 安国市| 夏河县| 濉溪县| 文昌市| 时尚| 吉木萨尔县| 莱芜市| 资溪县| 淮安市| 那曲县| 灵丘县| 闵行区| 丰宁| 星座| 荔波县| 南漳县| 增城市| 登封市| 磐安县| 遂平县| 寿阳县| 城步| 东安县| 山东| 靖西县| 天祝| 大竹县| 凤山市| 西峡县| 大关县| 华蓥市| 蚌埠市| 十堰市| 香格里拉县| 利辛县| 周口市| 梁河县| 龙州县| 夏邑县|