Python Matplotlib忽略xlabel

Python Matplotlib忽略xlabel,python,matplotlib,Python,Matplotlib,我正在创建一个绘图,我想在轴和标题上添加标签,但它不知何故忽略了plt.xlabel: import matplotlib.pyplot as plt import numpy as np import scipy.stats as sp plt.xlabel = '# blinds' plt.ylabel = 'time (ms)' plt.title = 'Encryption Performance' fig = plt.figure(0) single_high_error = s

我正在创建一个绘图,我想在轴和标题上添加标签,但它不知何故忽略了
plt.xlabel

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as sp

plt.xlabel = '# blinds'
plt.ylabel = 'time (ms)'
plt.title = 'Encryption Performance'

fig = plt.figure(0)

single_high_error = single_high - datasinglecoremeans
single_low_error = abs(single_low - datasinglecoremeans)
multi_high_error = multi_high - datamulticoremeans
multi_low_error = abs(multi_low - datamulticoremeans)

plt.errorbar(datasinglecore[0], datasinglecoremeans, yerr=np.vstack((single_high_error, single_low_error)), ecolor='skyblue', color='b', label = '1 core')
plt.errorbar(datamulticore[0], datamulticoremeans, yerr=np.vstack((multi_high_error, multi_low_error)), ecolor='orange', color='r', label = '4 cores')
# plt.xscale('log')
# plt.yscale('log')

plt.legend()

fig.savefig("encryption.png")
plt.show()

这就是它看起来的样子:有人能告诉我我做错了什么吗?

因为你分配的不正确,应该是这样的

plt.xlabel('# blinds')
plt.ylabel('time (ms)')
plt.title('Encryption Performance')
你所做的在语法上是不正确的。例如,
xlabel
是前面提到的一个函数,如果你试图给一个函数赋值,那么这个函数是错误的,你必须使用它的签名。与
ylabel
abd
title
相同