请告诉我。有必要使用 Matplotlib 绘制球员工资对俱乐部的依赖关系,俱乐部的名称不是数值。
我正在这样策划
import numpy as np
import matplotlib.pyplot as plt
height = df['Wage']
bars = df['Club']
y_pos = np.arange(len(bars))
# Create bars
plt.bar(y_pos, height)
# Create names on the x-axis
plt.xticks(y_pos, bars)
# Show graphic
plt.show()
如何避免在 x 轴上出现印迹,以便我可以看到球杆的名称。链接到数据集 - https://disk.yandex.ru/i/Kev7UcF11qljiQ
你可以这样做:
首先,我们准备数据,去掉多余的,只留下前 50 名的俱乐部:
然后,实际上,我们绘制:
我们得到这个: