制作3D散点图出现错误
module 'matplotlib.pyplot' has no attribute 'zlabel'
我的代码:
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
df=pd.read_csv('F:\jupyter\example2_4.csv',encoding='gbk')
ax3d=plt.figure(figsize=(10,10)).add_subplot(111,projection='3d')
ax3d.scatter(df['每股收益'],df['每股净资产'],df['总股本'],color='black',marker='*',s=50)
ax3d.set_xlabel('每股收益',fontsize=12)
ax3d.set_ylabel('每股净资产',fontsize=12)
ax3d.set_zlabel('总股本',fontsize=12)
plt.xlabel('x=每股收益',fontsize=12)
plt.ylabel('y=每股净资产',fontsize=12)
plt.zlabel('z=总股本',fontsize=12)
运行结果及报错内容
AttributeError Traceback (most recent call last)
Input In [43], in <cell line: 16>()
14 plt.xlabel('x=每股收益',fontsize=12)
15 plt.ylabel('y=每股净资产',fontsize=12)
---> 16 plt.zlabel('z=总股本',fontsize=12)
AttributeError: module 'matplotlib.pyplot' has no attribute 'zlabel'