读取表格数据绘制三维地形 和等值线

import matplotlib.pyplot  as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

from scipy.interpolate import griddata

fig=plt.figure()
ax = Axes3D(fig)

df=pd.read_csv("02.csv")

x=df["y"]
y=df["x"]
z=df["h"]
#print(x,y,z)

x=np.array(x)
y=np.array(y)





z = np.array(z)


ax.plot_trisurf(x,y,z,linewidth=0.1, antialiased=True)
ax.set_zlim(600,800)


C=ax.tricontour(x, y, z,70,zdir='z',offset=650, linewidths=0.3,colors="black" )
#plt.clabel(C,inline=True,fontsize=10)
plt.rcParams['font.sans-serif']=['SimHei']

plt.rcParams['axes.unicode_minus'] =False
plt.title('乌鲁木齐水磨沟区B地地形')


plt.xlabel("x")
plt.ylabel("y")

plt.show()

![在这里插入图片描述](https://img-blog.csdnimg.cn/20200630004250919.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTExNjI0,size_16,color_FFFFFF,t_70#pic_center)

你可能感兴趣的:(python)