Axes3D不显示图

时间:2019-05-12 05:54:38

标签: matplotlib

我正在练习Axes3D以玩3D图形。运行代码时,我可以生成轴,但其中没有任何图。

from mpl_toolkits.mplot3d import Axes3D

df_test=pd.DataFrame(data=np.random.normal(0,1,(20,3)),columns=['a','b','c'])
fig=plt.figure()
ax=fig.add_subplot(111,projection='3d')
ax.scatter=(df_test['a'],df_test['b'],df_test['c'])
ax.set_xlabel('a')
ax.set_ylabel('b')
ax.set_zlabel('c')
plt.show()

结果如下所示:如图所示,没有图,只有轴。我在代码中做错了什么?非常感谢!

1 个答案:

答案 0 :(得分:0)

return Scaffold( body: Stack( fit: StackFit.expand, children: <Widget>[ Container( alignment: Alignment.center, decoration: BoxDecoration( gradient: LinearGradient(colors: [ Colors.deepPurple, Colors.purple[700], Colors.purple ], begin: Alignment.topCenter, end: Alignment.bottomCenter)), padding: EdgeInsets.all(30.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ _withSocialMedia, _or, _withEmail, SizedBox(height: 50.0), ], ), ), ], ), ); 行应替换为

ax.scatter=(df_test['a'],df_test['b'],df_test['c']),因为您不需要ax.scatter(df_test['a'],df_test['b'],df_test['c'])运算符。

=

结果是:

enter image description here