NMath User's Guide

TOC | Previous | Next | Index

12.4 Displaying Histograms (.NET, C#, CSharp, VB, Visual Basic, F#)

The Histogram class provides two methods for displaying a histogram textually. The ToString() member function returns a formatted string representation of a histogram. If the bin boundaries are b0, b1, b2,...,bn-1, and the counts for these bins are c1, c2,...,cn, respectively, then ToString() returns a string with the following format:

[b0,b1)  :   c1
[b1,b2)  :   c2
[b2,b3)  :   c3
.
.
.
[bn-2,bn-1]: cn

The provided StemLeaf() method formats the contents of a histogram into a simple ASCII stem-leaf diagram with the following form:

[b0,b1):     *****c1
[b1,b2):     **********c2
[b2,b3):     ***************c3
.
.
.
[bn-2,bn-1]: *****cn

The number of asterisks represents the count for that bin minus one.


Top

Top