python - 属性错误 : module 'matplotlib.pyplot' has no attribute 'xlable'

标签 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',lablesize=14)
plt.show()

enter image description here

是不是版本的问题?

最佳答案

你可以这样尝试:

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

你的问题是而且应该改成,

xlable -> xlabel,

ylable -> ylabel,

labelsize -> labelsize,把label拼对

关于python - 属性错误 : module 'matplotlib.pyplot' has no attribute 'xlable' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44381036/

相关文章:

python-3.x - 是否可以使用 seaborn 执行 "zoom inset"?

python - 如何为 'plt.contour' 中的曲线添加图例条目?

python - 获取 ZeroDivisionError : float division in python

python - 用零替换python数组中的Nones

Python:在运行时动态创建函数

python - psycopg2.InternalError 无论我做什么

python - 使用pylab同时显示两个png图像

python - 在复平面加corr中找到A(x)和B(y)的交点。 x和y

python - 如何在 Apache Spark 预构建版本中添加任何新库,如 spark-csv

python - 如何从Python中的2D列表中获取最大x和最小y坐标?