1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| import matplotlib.pyplot as plt import pandas as pd
shoot = { 'italy': [119, 74, 71, 68, 65, 61, 58, 56, 55, 51], 'spain': [56, 46, 42, 39, 37, 36, 35, 33, 33, 32], 'england': [64, 61, 55, 53, 53, 47, 44, 44, 43, 42], 'germany': [63, 62, 49, 48, 47, 46, 44, 44, 44, 41] }
goal = { 'italy': [13, 11, 10, 10, 10, 9, 8, 8, 7, 7], 'spain': [15, 11, 11, 10, 8, 8, 8, 8, 8, 7], 'england': [12, 11, 9, 9, 8, 8, 8, 8, 8, 8], 'germany': [12, 12, 11, 11, 10, 9, 9, 9, 8, 7] }
shoot_leader = { 'Cristiano Ronaldo': (1, 119), 'Werner': (1, 63), 'Messi': (1, 56), 'Salah': (1, 64) }
goal_leader = { 'Aubameyang': (1, 12), 'Messi': (1, 15), 'Pia Turk': (1, 13), 'Iovich': (1, 12) }
x = [i + 1 for i in range(10)] df = pd.DataFrame(shoot, x) ax = df.plot() for key, value in shoot_leader.items(): plt.annotate(key, value) plt.title("Top 10 shoot times distribution of 4 leagues")
df_goal = pd.DataFrame(goal, x) df_goal.plot() for key, value in goal_leader.items(): plt.annotate(key, value) plt.title("Top 10 goal distribution of 4 leagues")
plt.show()
|