我读过关于这个错误的所有类似的问题,它们要么是拼写错误,要么是导入matplotlib.pyplot as plt
错误。
我的代码如下。
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
plt.hist(raw_data['smoker'], bins=3, color='gray')
plt.xlabel('Smoker')
plt.show()
我不知道这个错误的原因是什么。可能是图书馆版本?我什么也没发现
这是错误:AttributeError: module 'matplotlib.pyplot' has no attribute 'xlabel'
发布于 2022-11-18 01:11:00
我使用的是matplotlib
版本的3.5.2
,它可以工作。
您可以尝试使用以下命令:
pip install matplotlib==3.5.2
https://stackoverflow.com/questions/74483898
复制相似问题