Skip to content

Pareto Chart

1
pareto(y);

example_pareto_1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <cmath>
#include <matplot/matplot.h>
#include <random>

int main() {
    using namespace matplot;

    std::vector<double> y = {90, 75, 30, 60, 5, 40, 40, 5};
    pareto(y);

    show();
    return 0;
}

More examples

example_pareto_2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <cmath>
#include <matplot/matplot.h>
#include <random>

int main() {
    using namespace matplot;

    std::vector<double> codelines = {200, 120, 555, 608, 1024, 101, 57, 687};
    std::vector<std::string> coders = {"Fred",  "Ginger", "Norman", "Max",
                                       "Julia", "Wally",  "Heidi",  "Pat"};

    pareto(codelines, coders);
    title("Lines of Code by Programmer");

    show();
    return 0;
}

example_pareto_3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <cmath>
#include <matplot/matplot.h>
#include <random>

int main() {
    using namespace matplot;

    std::vector<double> votes = {35, 50, 30, 5, 80};
    std::vector<std::string> pies = {"Chocolate", "Apple", "Pecan", "Cherry",
                                     "Pumpkin"};

    pareto(votes, pies, 1.0);
    ylabel("Votes");

    show();
    return 0;
}

example_pareto_4

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <cmath>
#include <matplot/matplot.h>
#include <random>

int main() {
    using namespace matplot;

    std::vector<double> y = {10, 23, 7, 16, 3};
    pareto(y);

    show();
    return 0;
}

Pareto Charts are a type of chart that uses both axes. The axis is used to represent bars with the data values in descending order. The axis is used to represent the cumulative distribution function of the data in the axis. By default, a Pareto Chart includes up to 10 items or as many items as needed to represent 95% of the cumulative distribution.

If you need Pareto fronts rather than Pareto charts, we refer to Scatter Plots for two-dimensional fronts, Plot matrices for three-dimensional fronts, or Parallel Coordinate Plots for many-objective fronts. These plot subcategories are described in Section Data Distribution. If you also need a tool to calculate these fronts efficiently, we refer to the Pareto Front Library.