pareto

Pareto chart: bars sorted in descending order with a line of the cumulative percentage.

Category: Graphics > 2-D and 3-D Plots

Syntax

pareto(y)

Sorts the values y from largest to smallest, plots them as bars and adds the cumulative total as a line.

pareto(y, names)

Labels the bars with names (cell array or string array).

pareto(y, x)

Labels the bars with the numeric vector x.

pareto(___, threshold)

Shows only the bars needed to reach the fraction threshold of the total, 0.95 by default.

Description

The chart supports the rule of thumb that a few causes account for most of the total. The bars show each cause, largest first, and the right-hand axis shows the running percentage. Only the bars that bring the total up to the threshold are drawn.

Input arguments

y
Vector of non-negative values, for instance the number of defects per cause.
names
Labels, one per value.

Example

Causes of defects

defects = [24 5 40 9 3 19];
causes = {'Scratch','Dent','Crack','Stain','Burr','Chip'};
pareto(defects, causes)

In the app, the chart is drawn below the code.

See also

bar histogram cumsum sort pie