International Mathematical Olympiad Top Countries

Peter Xie
2 min readSep 16

--

Made with Matplotlib

Data source: https://www.imo-official.org/results.aspx

Source Code: Colab

import matplotlib.pyplot as plt
import numpy as np

def to_int(l: list):
return [ int(i) for i in l ]
def reverse_list(l: list):
return list(reversed(l))
# Data for plotting
# Source: https://www.imo-official.org/results.aspx
year = reverse_list('21 20 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01'.split())
CHN = reverse_list(to_int('1 1 1 3 2 3 2 1 1 2 1 1 1 1 2 1 1 1 2 1 1'.split()))
USA = reverse_list(to_int('4 3 1 1 4 1 1 2 3 3 2 3 6 3 5 5 2 2 3 3 2'.split()))
RUS = reverse_list(to_int('2 2 6 2 11 7 8 4 4 4 4 2 3 2 1 2 3 3 5 2 2'.split()))
KOR = reverse_list(to_int('3 4 3 7 1 2 3 7 2 1 13 4 4 4 3 3 5 12 6 6 4'.split()))

fig, ax = plt.subplots()
ax.plot(year, CHN, color='red', marker='*', label='China')
ax.plot(year, USA, color='blue', marker='d', label='USA')
ax.plot(year, RUS, color='green', marker='x', label='Russia')
ax.plot(year, KOR, color='orange', marker='o', label='Korea')

ax.set(xlabel='Year', ylabel='Ranking',
title='International Mathematical Olympiad Ranking of Countries')
ax.grid()
# Set yticks explicitly so rank 1 is displayed, otherwise 2, 4, 6 ...
ax.set_yticks(np.arange(0, 15, 1))

plt.legend()
# invert y axis to make small value 1 on the top
plt.gca().invert_yaxis()
fig.savefig("test.png")
plt.show()

--

--

Peter Xie

Code Simple | Python and AI Enthusiast | peter.jp.xie@gmail.com