All Medals of Michael Phelps

Until Rio 2016, Michael Phelps got 22 medals including 18 gold ones. This makes you wonder if he can remember all the medals he got. To make his life easier, we can easily generate a table with all the medals. To do this, we use 'by athlete' and filter all the Olympic medals to look only at Michael Phelps and then we display the result in a table.

options source

Loading content, please wait...

If you want to change the athlete, you can modify the source code and type . after 'by athlete' on the second line. You can also do the same in "options" by picking a country and then choosing an athlete.

For a more complicated modification, you can change the code to use grouping (similarly to the visualizations counting medals per athlete) to find out that Michael Phelps medals from 8 different disciplines, 3 of them being relay events and the remaining 5 being individual. This can by done by using `'group data'.'by Event' after getting the data. The visualization Medals by Event and Games shows the result.

If you are interested in the project or you would like to collaborate on visualizing interesting data, drop us an email at tomas@tomasp.net, ping us on Twitter at @thegamma_net. All source code is available under Apache 2.0 license on GitHub.

If Michael Phelps Were a Country

Back in 2012, The Guardian put together an amazing table treating Michael Phelps as a country. We can do the same and count the total number of medals per country and total number of medals for Michael Phelps. Sorted by the number of gold medals, Michael Phelps beats for example Belarus and Kazakhstan. And after Rio 2016, probably also Zimbabwe, Nigeria and a few more countries!

options source

Loading content, please wait...

This visualization involves a bit more logic, so it is not as easy to modify, but you can easily change it to look at another athlete or even add multiple athletes. When you look at "options", you will see a number of parameters for both of the parts of the calculation, but the very first one lets you select a different athlete. When you do that, you'll also need to change what range of countries you are selecting. In the code, look for skip(47).take(10). This skips the first 47 countries (who have way more medals than Michael Phelps) and takes the next 10, so that we get a nice chart. You'll need to guess the right number for your favorite athlete.

Aside from showing one athlete, you can also modify the visualization to include multiple athletes. For example, see the visualization If Phelps and Latynina were Countries, which shows a similar chart with the two top athletes when sorted by gold medals.