Solutions Company Statit Training Home
 



Adding More Useful Tick Mark Labels to a Histogram

Abstract: Sometimes, when drawing a histogram, the number of tick labels do not match up with lines on the bars. With a few minor calculations and specifying a few more options on the ghist command, you can easily make sure that the values encompassed in each bar are clearly defined, regardless of the number of bars of values in your data.

Products: Statit e-QC, Statit e-Server, Statit Custom QC

For example, take the follow commands used to generate a Histogram chart:

getfile "qc.wrk" /begin
ghist Temperature

It generates output like this:

The boundaries of the bars do not match up exactly with the tick label marks. Users often find this confusing as they try to determine the frequency of their measurements within a given range. Using a few quick calculations and given a tick mark step value, we can find out the number of bars needed to make these match up. Try the following:

getfile qc.wrk /be
## Specify the step value here
#step = 5
## Calculate number of bars necessary for specified step value
$bars = int((max(Temperature) - min(Temperature))/ #step) + 1
## Draw histogram
ghist Temperature /classes=$bars /step=#step

It generates output like this:

As you can see, the tick marks and labels now line up directly with the edges of the histogram bars. To increase the number of bars in this example, simply lower the tick mark step value.