MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / scotts_rule

Method scotts_rule

source/matplot/axes_objects/histogram.cpp:365–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363 }
364
365 std::vector<double> histogram::scotts_rule(const std::vector<double> &x,
366 double minx, double maxx,
367 bool hard_limits) {
368 double binwidth =
369 3.5 * stddev(x) / (pow(static_cast<double>(x.size()), 1. / 3.));
370 if (!hard_limits) {
371 return bin_picker(minx, maxx, 0, binwidth);
372 } else {
373 double max_x = *std::max_element(x.begin(), x.end());
374 double min_x = *std::min_element(x.begin(), x.end());
375 return bin_pickerbl(min_x, max_x, minx, maxx, binwidth);
376 }
377 }
378
379 std::vector<double> histogram::fd_rule(const std::vector<double> &x,
380 double minx, double maxx,

Callers

nothing calls this directly

Calls 5

stddevFunction · 0.85
bin_pickerblFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected