Pareto chart not displaying all inputs (some too small(?))

Hi all,
I want to use a pareto chart to illustrate error components of a total error on a measurement. I wrote:
Er_components = [e1^2,e2^2,e3^2,e4^2,e5^2];
Er_cat = {'Precision', 'Load Cell Accuracy', 'Resolution', 'DAQ gain', 'DAQ offset'};
pareto(Er_components,Er_cat);
ylabel('(Total Error)^{2} on Voltage Measurement (mV/V)^{2}');
title('Error Contribution at Low Re');
The only issue is that 3/5 are very small once squared, and the chart wont display the cateogories. I was wondering if there was a way to get it to display the other factors.

Answers (1)

The default behavior is described in the documentation:
"By default, either the tallest 10 bars or first 95% of the cumulative distribution is displayed, whichever is smaller."
The example here shows how to display all values in the cumulative distribution. Below I've modified your example as well (using made up error values).
e1 = 0.0025;
e2 = 0.0374;
e3 = 0.005;
e4 = 0.0255;
e5 = 0.001;
Er_components = [e1^2,e2^2,e3^2,e4^2,e5^2];
Er_cat = {'Precision', 'Load Cell Accuracy', 'Resolution', 'DAQ gain', 'DAQ offset'};
pareto(Er_components,Er_cat,1); % add a third input, ",1" to display all values
ylabel('(Total Error)^{2} on Voltage Measurement (mV/V)^{2}');
title('Error Contribution at Low Re');

5 Comments

When I add a third input, 1, this is what I get:
ALSO this error:
Undefined function or variable 'names'.
Error in pareto (line 90)
set(cax, 'XTick', 1:k, 'XTickLabel', mat2cell(names(ndx(1:k), :), ones(1, k)),
'YLim', yLim);
Error in Windtunnel_LiftDragCoeff_112020 (line 551)
pareto(Er_components,Er_cat,1);
My values are:
e1= 0.0022
e2 = 0.0373
e3 = 1.49 *10^-6
e4 = 1.42 *10^-9
e5 = 0.025
I wanted to square the components so that once added it would result in the total error squared. Even when I do not square the above values I get the same result. Its like its not assigning the names to the values, maybe because some are sooooo tiny? I'm not sure, I really want to acknowledge they are there.
What version of MATLAB are you using? I am running your code here in this window using 2020b, so the results you see here are what you should get. Here I've updated it to use your values.
e1= 0.0022;
e2 = 0.0373;
e3 = 1.49 *10^-6;
e4 = 1.42 *10^-9;
e5 = 0.025;
Er_components = [e1^2,e2^2,e3^2,e4^2,e5^2];
Er_cat = {'Precision', 'Load Cell Accuracy', 'Resolution', 'DAQ gain', 'DAQ offset'};
pareto(Er_components,Er_cat,1); % add a third input, ",1" to display all values
ylabel('(Total Error)^{2} on Voltage Measurement (mV/V)^{2}');
title('Error Contribution at Low Re');
I am using R2019a. I will get an upgrade and see, thanks for your help!
It appears this functionality was first added in R2020a.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 2 Dec 2020

Commented:

on 3 Dec 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!