1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > python散点图解_python 画三维图像 曲面图和散点图的示例

python散点图解_python 画三维图像 曲面图和散点图的示例

时间:2021-01-19 19:25:48

相关推荐

python散点图解_python 画三维图像 曲面图和散点图的示例

用python画图很多是根据z=f(x,y)来画图的,本博文将三个对应的坐标点输入画图:

散点图: import matplotlib.pyplot as plt

from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()

ax = fig.add_subplot(111, projection='3d')

X = [1, 1, 2, 2]

Y = [3, 4, 4, 3]

Z = [1, 2, 1, 1]

ax.scatter(X, Y, Z)

plt.show()

曲面图: import matplotlib.pyplot as plt

from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()

ax = fig.add_subplot(111, projection='3d')

X = [1, 1, 2, 2]

Y = [3, 4, 4, 3]

Z = [1, 2, 1, 1]

ax.plot_trisurf(X, Y, Z)

plt.show()

以上这篇python 画三维图像 曲面图和散点图的示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持聚米学院。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。