/ (1 + log2 (es[v].cc))
;
- bin_width = chart_rounded_tick (bin_width);
-
es[v].histogram =
histogram_create (bin_width, es[v].minimum, es[v].maximum);
}
/* Freedman-Diaconis' choice of bin width. */
iqr = calculate_iqr (frq);
bin_width = 2 * iqr / pow (valid_freq, 1.0 / 3.0);
- bin_width = chart_rounded_tick (bin_width);
histogram = histogram_create (bin_width, x_min, x_max);
assert (bin_width > 0);
+ bin_width = chart_rounded_tick (bin_width);
bins = adjust_bin_ranges (bin_width, min, max, &adjusted_min, &adjusted_max);
/* Force the number of bins to lie in a sensible range. */
if (bins > MAX_BINS)
{
- bins = adjust_bin_ranges ((max - min) / (double) (MAX_BINS - 1),
+ bin_width = chart_rounded_tick ((max - min) / (double) (MAX_BINS - 1));
+ bins = adjust_bin_ranges (bin_width,
min, max, &adjusted_min, &adjusted_max);
}
gsl_histogram *gsl_hist;
};
-struct histogram * histogram_create (double bin_width, double max, double min);
+/*
+ Prepare a histogram for data which lies in the range [min, max)
+ bin_width is a nominal figure only. It is a hint about what might be
+ an good approximate bin width, but the implementation will adjust it
+ as it thinks fit.
+ */
+struct histogram * histogram_create (double bin_width, double min, double max);
void histogram_add (struct histogram *h, double y, double c);