print_histogram

Summary: Prints a text-based histogram representation of a given histogram dataset. The function scales the frequency of each bin into a visual bar made of asterisks (*).

void
print_histogram
(
T
)
()

Parameters

hist T

A tuple containing: - hist[0]: An array of bin counts (frequencies). - hist[1]: An array of bin edges or values.

Return Value

Type: void

None (prints the histogram to standard output).

Notes: - The function normalizes the histogram bars relative to the maximum bin frequency (maxFreq). - Each bin's frequency is represented by asterisks, with the widest bin corresponding to maxWidth = 50 characters. - Uses reduce!max to determine the highest bin count for scaling. - Writes the histogram using writefln, formatting bin values to two decimal places. - If hist[0] contains zero values, no asterisks will be printed for those bins. - Useful for quick visualization of a dataset’s distribution.