fig = plt.figure(facecolor='w')#生成图
ax = fig.add_subplot(111, projection='3d')#绘制子图
ax.scatter(t[0], t[1], density, c='r', s=50*density, marker='o', depthshade=True)#ax.scatter用于绘制点
ax.plot_surface(t[0], t[1], density, cmap=cm.Accent, rstride=1, cstride=1, alpha=0.9, lw=0.75)#plot_surface用于绘制面
x.set_xlabel('X')#设置坐标轴
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.title('二元高斯分布,样本个数:%d' % d.shape[0], fontsize=15)
plt.tight_layout(0.1)#设置子图间距或边距
plt.show()#显示

  

05-01 01:55
查看更多