我正在构建水平条形图。
这是我的代码:
from matplotlib import pyplot as plt
plt.barh(xg_data['Team'], xg_data['GD_vs_xGD'])
我的数据集 xg_data
S.no.
Team Games G GA xG xGA NPxG NPxGA GD xGD NPxGD GD_vs_xGD
0
Arsenal 8 19 10 10.41 10.95 10.41 10.95 9 -0.54 -0.54 9.54
5
Chelsea 8 18 5 15.72 8.59 13.44 8.59 13 7.13 4.85 5.87
3
Burnley 8 10 12 7.69 14.11 7.69 13.35 -2 -6.42 -5.66 4.42
16
Tottenham 8 15 7 14.79 9.66 13.27 9.66 8 5.13 3.61 2.87
10
Leicester 8 14 12 9.14 8.58 7.62 7.05 2 0.56 0.57 1.44
7
Everton 8 13 12 9.52 9.76 8.76 9.00 1 -0.24 -0.24 1.24
11
Liverpool 8 15 3 16.66 5.90 15.90 5.14 12 10.76 10.76 1.24
2
Brighton 8 9 13 9.49 14.71 6.44 12.43 -4 -5.22 -5.99 1.22
6
Crystal Palace 8 5 9 7.02 11.56 7.02 9.28 -4 -4.54 -2.26 0.54
14
Newcastle 8 6 13 5.98 12.86 5.22 11.34 -7 -6.88 -6.12 -0.12
18
West Ham 8 8 13 8.73 13.32 7.97 13.32 -5 -4.59 -5.35 -0.41
12
Manchester City 8 21 3 22.49 4.00 21.72 4.00 18 18.49 17.72 -0.49
17
Watford 8 11 12 10.55 11.01 10.55 10.25 -1 -0.46 0.30 -0.54
19
Wolverhampton Wanderers 8 9 6 11.06 6.15 11.06 6.15 3 4.91 4.91 -1.91
1
Bournemouth 8 16 12 16.08 9.25 12.27 7.73 4 6.83 4.54 -2.83
13
Manchester United 8 13 14 12.83 10.98 10.54 10.22 -1 1.85 0.32 -2.85
8
Fulham 8 9 21 9.41 18.00 9.41 15.71 -12 -8.59 -6.30 -3.41
9
Huddersfield 8 4 17 4.75 13.26 4.75 11.74 -13 -8.51 -6.99 -4.49
15
Southampton 8 6 14 10.61 14.02 9.09 13.26 -8 -3.41 -4.17 -4.59
4
Cardiff 8 4 17 7.44 13.68 7.44 11.40 -13 -6.24 -3.96 -6.76