Python 属性错误:模块';matplotlib.pyplot';没有属性';xlable';

Python 属性错误:模块';matplotlib.pyplot';没有属性';xlable';,python,matplotlib,Python,Matplotlib,是因为问题的版本吗?您可以这样尝试: import matplotlib.pyplot as plt squares = [1,4,9,16,25] plt.plot(squares,linewidth=5) plt.title('Square Number',fontsize=24) plt.xlable('Value',fontsize=14) plt.ylable('Square of Value',fontsize=14) plt.tick_params(axis='both',l


是因为问题的版本吗?

您可以这样尝试:

import matplotlib.pyplot as plt

squares = [1,4,9,16,25]
plt.plot(squares,linewidth=5)

plt.title('Square Number',fontsize=24)
plt.xlable('Value',fontsize=14)
plt.ylable('Square of Value',fontsize=14)

plt.tick_params(axis='both',lablesize=14)
plt.show()
你的问题是,而且应该改为


xlable
->
xlabel

ylable
->
ylabel


labelsize
->
labelsize
,将
label
拼写正确。

xlable
xlabel,
ylable
ylabel,
labelsize
您可能只需要正确拼写“label”。
import matplotlib.pyplot as plt

squares = [1,4,9,16,25]
plt.plot(squares,linewidth=5)

plt.title('Square Number',fontsize=24)
plt.xlabel('Value',fontsize=14)
plt.ylabel('Square of Value',fontsize=14)

plt.tick_params(axis='both',labelsize=14)
plt.show()