Python三维图
image.png#encoding=utf-8
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# 3D coordination
fig = plt.figure()
ax = fig.gca(projection='3d')
#set axis length
ax.set_xlim(70, 200)
ax.set_ylim(-90, 180)
ax.set_zlim(0, 10)
# set axis label
ax.set_zlabel('Z', fontdict={'size': 15, 'color': 'red'})
ax.set_ylabel('Y', fontdict={'size': 15, 'color': 'blue'})
ax.set_xlabel('X', fontdict={'size': 15, 'color': 'yellow'})
plt.show()
空间数据散点图
image.png因为坐标轴没用从零点开始,所以绘制蓝色的点表示(0,0,0)坐标原点
#encoding=utf-8
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
# np.array( ) 切片 input data
data=np.array([
[129.0, 7.5, 4],
[140.0, 141.5, 8],
[108.5, 28.0, 6],
[ 88.0, 147.0, 8],
[185.5, 22.5, 6],
[195.0, 137.5, 8],
[105.5, 85.5, 8],
[157.5, -6.5, 9],
[107.5, -81.0, 9],
[ 77.0, 3.0, 8],
[81.0, 56.5, 8],
[162.0, 84.0, 4],
[117.5, -38.5, 9],
[162.0, -66.5, 9] ])
x = data[:,0]
y = data[:,1]
z = data[:,2]
ax.scatter(x, y, z, c='r')
ax.scatter(0, 0, 0, c='b')
ax.set_xlim(70, 200)
ax.set_ylim(-90, 180)
ax.set_zlim(0, 10)
ax.set_zlabel('Z', fontdict={'size': 15, 'color': 'red'})
ax.set_ylabel('Y', fontdict={'size': 15, 'color': 'red'})
ax.set_xlabel('X', fontdict={'size': 15, 'color': 'red'})
plt.show()
1.https://giscourses.cfans.umn.edu/sites/giscourses.cfans.umn.edu/files/interpolation.pdf
-
https://system.umn.edu/
一个简答的IDW插值Demo
通过三个已知点对中间点的数值进行插值估算。
image.png
#encoding=utf-8
import numpy as np
import matplotlib.pyplot as plt
z =np.array([50,30,52])
d=np.array([4,2,6])
p=1
A=sum(z*1/(d**p))
B=sum(1/(d**p))
z0=A/B
print(z0)
网友评论