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:
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.
Type the following command to make a histogram plot:
plot [-2:2] 'parabola.text' with histeps
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.