Analyzing medal counts in all olympia data
2 views (last 30 days)
Show older comments
Markus Eckhardt
on 23 Jan 2022
Answered: Image Analyst
on 24 Jan 2022
So I have a table with 150+ countries and their respective medal counts. To analyze the data considering the power law distribution I want to plot it into a histogram and rank plot. But I think with that many countries it would be to chaotic. How would you suggest for me to plot the medal count distribution in a more convenient way?
0 Comments
Accepted Answer
Image Analyst
on 24 Jan 2022
fileName = 'medals_total.csv'
t = readtable(fileName);
% Get rid of last row
t = t(1:end-1, :)
counts = t.CombinedTotal;
sortedt = sortrows(t, 2, 'descend')
% Plot by country
subplot(2, 1, 1);
bar(sortedt.CombinedTotal)
grid on;
xlabel('Country')
ylabel('Medal count')
% Take histogram of how many countries won different amounts of medals
subplot(2, 1, 2);
histogram(counts, 30)
grid on;
xlabel('Medal count')
ylabel('# Countries with that Medal count')
0 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!