Python AttributeError: 模块 'matplotlib.pyplot' 没有属性 'xlable'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44381036/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 23:57:56  来源:igfitidea点击:

AttributeError: module 'matplotlib.pyplot' has no attribute 'xlable'

pythonmatplotlib

提问by Bruin

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()

enter image description here

在此处输入图片说明

Is it because of the version of the problem?

是不是版本的问题?

回答by youDaily

You can try like this :

你可以这样尝试:

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()

you question is,xlable-> xlabel, ylable-> ylabel, lablesize-> labelsize, spell the labelright.

你的问题是,xlable-> xlabel, ylable-> ylabel, lablesize-> labelsize,拼写label正确。