Help with creating a different type of pareto chart?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Forrest
el 6 de Dic. de 2019
Comentada: Forrest
el 6 de Dic. de 2019
Hello,
I am wanting to create a pareto chart, but the standard chart that matlab creates is not exactly what I am looking for. I am looking to have a pareto chart that displays on the x-axis a histogram of the distribution, but then just simply displays the summed pareto line counting the percentage of data from left to right.
I can create an example of what I mean in excel using pivot tables, and manually creating a combo chart.
Assume the data I have is:
Y=[ 81 15 21 38 38 21 31 27 22 135 55 24 54 66 97 11 117 332 140 34 456 484 39 12 63 58 52 100 43 16 31 163 173 182 80 216 64 24 27 57 13 589 57 23 31 40 19 37 57 10 57 31 97 95 102 14 178 202 130 12 14 41 37 91 199]
If I run in Matlab pareto(Y), the image I get is the following:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/253126/image.png)
However, this is not exactly what I want. I can show an example of how I'd like it to look using excel. You can see here, the first column is the same data from the variable above Y, however it is only the UNIQUE values. The second column is the count of each occurrence(distribution). The third column is the running total of the count as a percentage of the grand total of items in Y.
The graph plotted is simply a combo chart, with a distribution of the first two columns, and the pareto line is simply the running total plotted on the right side secondary axis. The image of that is here:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/253127/image.png)
SO is there any easy way to accomplish this? I would like to keep the chart in ascending order in the way the excel image I have is.
Also, is there a way to bin this up if necessary, I.e., if I wanted to group values together to have a wider bin size?
0 comentarios
Respuesta aceptada
JESUS DAVID ARIZA ROYETH
el 6 de Dic. de 2019
Y=[ 81 15 21 38 38 21 31 27 22 135 55 24 54 66 97 11 117 332 140 34 456 484 39 12 63 58 52 100 43 16 31 163 173 182 80 216 64 24 27 57 13 589 57 23 31 40 19 37 57 10 57 31 97 95 102 14 178 202 130 12 14 41 37 91 199];
[s,~,idx]=unique(Y);
y= accumarray(idx,1);
figure;
bar(categorical(s),y);
hold on
plot(cumsum(y)/numel(Y),'r','LineWidth',4)
hold off
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!