How to generate a pareto plot with an ordered X-axis?
9 views (last 30 days)
Show older comments
Hello,
I'm looking to organize my data into a plot similar to a pareto plot, but I want the x-axis to be in ascending order from zero like a normal scatter plot. Another way to describe what I am looking for is a histogram (where the x-axis is various buckets of values) but with the y-axis being the sum of the values in each bucket instead of occurences.
I attached some of my data, basically I want to be able to plot frequency on the x-axis, and the sum of column B on the Y axis. Column C is a running sum of Column B, and its basically this data that I want to see in bar form.
Is there a way I can modify the pareto or histogram functions to do what I want or do I need to do something from scratch?
Any insight would be appreciated.
Thanks,
Matt
0 Comments
Answers (1)
dpb
ungefär 7 timmar ago
xyz=readmatrix('sample_data1.csv');
whos xyz
xyz(1:10,:)
numel(unique(xyz(:,1))) % how many unique values of first column are there?
Well, they're all unique.
I'm not at all sure what, specifically, you envision the plot to be or how to interpret "plot frequency on the x-axis". What does "frequency" mean here?
One guess would be simply
bar(xyz(1:10:end,1),xyz(1:10:end,3))
that assumes equal number of rows/bin and the associated cumulative total at that bin location. One could even out the x-spacing by using
[~,edges,bin]=histcounts(xyz(:,1),nbins);
and use the last element of each bin edges to get the x-position associated with the bin to get the accumulated total for the bin.
I don't believe you could make the Pareto plot do anything like you want; it computes the distribution from the inputs regardless, you cannot change its internal interpretation of what the data represent.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!