标签在 Matplotlib 中未显示为 ax.set_xlabels

Labels not showing up with ax.set_xlabels in Matplotlib

出于某种原因,我的 xlabels 没有显示在此图表上。我不明白为什么它不起作用。任何帮助,将不胜感激。我的代码如下:

fig, ax = plt.subplots(nrows = 1, ncols = 1, figsize = (10,6))
plt.hist(result, bins = 100, axes = ax)
ax.axvline(x = 269, color = 'black')
ax.axvline(x = 332, color = 'red', ymax = 0.5)
ax.set_xlabels = 'Obama Electoral College Votes'
plt.show()

你不能给 set_xlabel 赋值,它是一个函数并且需要一个你可以使用的 argument/parameter ax.set_xlabel('Obama Electoral College Votes')