欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

用Python在三维图上标注特定点的坐标

时间:2023-08-25

import numpy as npfrom matplotlib import pyplot as pltfig = plt.figure()ax = plt.axes(projection="3d")x = y = np.arange(start=-1, stop=1, step=0.05)X, Y = np.meshgrid(x, y)Z = (X-Y)*(X+Y)ax.plot_surface(X,Y,Z,alpha=0.8, cstride=1, rstride = 1, cmap='rainbow')X=0.5Y=0.9Z=(X-Y)*(X+Y)ax.scatter(X,Y,Z,c="r")X=[0.5,0.5]Y=[0.9,0.9]Z=[-1,-0.5999999999]ax.plot(X,Y,Z,'r--')X=[0.5,0.5]Y=[-1,0.9]Z=[-1,-1]ax.plot(X,Y,Z,'r--')X=[0.5,1]Y=[0.9,0.9]Z=[-1,-1]ax.plot(X,Y,Z,'r--')ax.text(0.4,0.7,-0.4,'-0.5999')plt.show()fig.savefig("3d.jpg")

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。