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

Method automatic_rule

source/matplot/axes_objects/histogram.cpp:491–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489 }
490
491 std::vector<double> histogram::automatic_rule(const std::vector<double> &x,
492 double minx, double maxx,
493 bool hard_limits) {
494 double xrange = maxx - minx;
495 bool is_around_integers = std::all_of(x.begin(), x.end(), [](double x) {
496 return std::abs(x - round(x)) < 0.01;
497 });
498 if (is_around_integers && xrange <= 50) {
499 return integers_rule(x, minx, maxx, hard_limits);
500 } else {
501 return scotts_rule(x, minx, maxx, hard_limits);
502 }
503 }
504
505 std::vector<double>
506 histogram::histogram_edges(const std::vector<double> &data, double minx,

Callers

nothing calls this directly

Calls 2

beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected