python绘制地理分布图,使用python和matplotlib中的线条绘制地理数据图/地图

我想这就是你想要的——在三维坐标轴上画出等距线。我已经在评论中解释了每个部分的作用import matplotlib.pyplot as plt

from mpl_toolkits.mplot3d import Axes3D

import numpy as np

import itertools

#read in data from csv organised in columns labelled 'lat','lon','elevation'

data = np.recfromcsv('elevation-sample.csv', delimiter=',')

# create a 3d axis on a figure

fig = plt.figure()

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

# Find unique (i.e. constant) latitude points

id_list = np.unique(data['lat'])

# stride is how many lines to miss. set to 1 to get every line

# higher to miss more

stride = 5

# Extract each line from the dataset and plot it on the axes

for id in id_list[::stride]:

this_line_data = data[np.where(data['lat'] == id)]

lat,lon,ele = zip(*this_line_data)

ax.plot(lon,lat,ele, color='black')

# set the viewpoint so we're looking straight at the longitude (x) axis

ax.view_init(elev=45., azim=90)

ax.set_xlabel('Longitude')

ax.set_ylabel('Latitude')

ax.set_zlabel('Elevation')

ax.set_zlim([0,1500])

plt.show()

我用来测试的数据集不是我的,但我在github here上找到了它。在

输出如下:

aa7c91dd076695b95077711045711e4a.png

注意-如果我误解了你草图中的坐标轴标签,你可以交换经纬度。在


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部