首页 > 编程知识 正文

matlibplot中s的意思,matplotlib中文手册

时间:2023-05-05 04:23:19 阅读:129661 作者:4447

在本文的示例中,python matlibplot共享用于绘制3D图形的特定代码。 具体内容如下

1、散点图使用scatter

from mpl _ toolkits.MP lot3dimportaxes3dimportnumpyasnpfrommatplotlibimportpyplotasplt # 3d示例数据mu _ ve C1=NP.array ([ 生成采样数据mu_veC1=NP.array )的0 ) #平均向量cov _ mat1=NP.array ([ 1,0,0,0 ]、[ 0,1,0 ]、[ 0,0, 1] )协方差矩阵class1_sample=NP.Random.() ) ) ) 652 20 ) ) class2_ sample=NP.random.multivariate _ ) 20 ) class3_sample=NP.random 20 ) class1_ sample.shape-(20,3 ),20 rows,3 columns fig=PLT.figure (fig size ) 8 ) ) ax=fig.add_shape ) ) class projection=' 3d ' (ax.scatter (class1_ sample ) :0 ),class1_ ss class1_sample ) 336666 label=' class1' (ax.scatter (class2_ sample [ :0 ],class2_ sample [ :1 ] class2_sample ) 3360 label=' class2' (ax.scatter (class3_ sample [ :0 ],class3_ sample [ 3:1 ],clax ) class3_sample ) 3360 label=' class3' (ax.set _ xlabel ) variable x ' (ax.set _ ylabel ) variabley ' ) ax.set _ ax

2、直线使用plot3D

from mpl _ toolkits.MP lot3dimportaxes3dimportmatplotlib.pyplotaspltimportnumpyasnpfromitertoolsimportproduct,组合7 ) ) ax=fig.GCA ) projection=' 3d ' (ax.set _ aspect ) ' equal ' ) ) ) )。 0.2 ),[0.1,-0.1,-0.3] ) x _ outside=NP.array ([-1.2,0.3,-0.3],[0.8,-0.82,-0.9],[ 1,0.0 ] color='r ',s=50,marker row[1],row[2],color='k ',s=50 )立方体h=[-0.5,0.5 ] fors,ein combinations ()

希望以上是正文的全部内容,对大家的学习有帮助。 另外,请支持我们。

本文标题: python matlibplot绘制3D图形

本文地址:3358 www.CPP cns.com/jiao Ben/python/231772.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。