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

Method sqrt_rule

source/matplot/axes_objects/histogram.cpp:457–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455 }
456
457 std::vector<double> histogram::sqrt_rule(const std::vector<double> &x,
458 double minx, double maxx,
459 bool hard_limits) {
460 size_t nbins =
461 static_cast<size_t>(std::max(ceil(log2(x.size()) + 1.), 1.));
462 if (!hard_limits) {
463 double binwidth = (maxx - minx) / nbins;
464 if (std::isfinite(binwidth)) {
465 return bin_picker(minx, maxx, 0, binwidth);
466 } else {
467 return bin_picker(minx, maxx, nbins, binwidth);
468 }
469 } else {
470 return linspace(minx, maxx, nbins + 1);
471 }
472 }
473
474 std::vector<double> histogram::sturges_rule(const std::vector<double> &x,
475 double minx, double maxx,

Callers

nothing calls this directly

Calls 3

linspaceFunction · 0.85
maxFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected