Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > Python图形界面

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

来源:中文源码网    浏览:383 次    日期:2024-04-19 01:06:53
【下载文档:  python画三维图像曲面图和散点图的示例.txt 】


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 画三维图像 曲面图和散点图的示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持中文源码网。

相关内容