python画车辆轨迹图_python-2.7 – 使用底图在地图上绘制轨迹

import numpy as np

data = np.loadtxt('path-tracks.csv',dtype=np.str,delimiter=',',skiprows=1)

print data

[['19.70' '-95.20' '2/5/04 6:45 AM' '1' '-38' 'CCM']

['19.70' '-94.70' '2/5/04 7:45 AM' '1' '-48' 'CCM']

['19.30' '-93.90' '2/5/04 8:45 AM' '1' '-60' 'CCM']

['19.00' '-93.50' '2/5/04 9:45 AM' '1' '-58' 'CCM']

['19.00' '-92.80' '2/5/04 10:45 AM' '1' '-50' 'CCM']

['19.20' '-92.60' '2/5/04 11:45 AM' '1' '-40' 'CCM']

['19.90' '-93.00' '2/5/04 12:45 PM' '1' '-43' 'CCM']

['20.00' '-92.80' '2/5/04 1:15 PM' '1' '-32' 'CCM']

['23.10' '-100.20' '30/5/04 4:45 AM' '2' '-45' 'SCME']

['23.20' '-100.00' '30/5/04 5:45 AM' '2' '-56' 'SCME']

['23.30' '-100.00' '30/5/04 6:45 AM' '2' '-48' 'SCME']

['23.30' '-100.20' '30/5/04 7:45 AM' '2' '-32' 'SCME']

['23.40' '-99.00' '31/5/04 3:15 AM' '3' '-36' 'SCM']

['23.50' '-98.90' '31/5/04 4:15 AM' '3' '-46' 'SCM']

['23.60' '-98.70' '31/5/04 5:15 AM' '3' '-68' 'SCM']

['23.70' '-98.80' '31/5/04 6:15 AM' '3' '-30' 'SCM']]

使用上面的代码我得到一个数组,其列代表:[Lat,Lon,Date,Identifier,Temperatures,Category].现在,我将放置一个代码,允许我绘制墨西哥地图上的第一和第二列:

#!/usr/bin/python

#Project Storm: Plot trajectories of convective systems

#import libraries

import numpy as np

from mpl_toolkits.basemap import Basemap

import matplotlib.pyplot as pl

# Plot a map for Mexico

m = Basemap(projection='cyl', llcrnrlat=12, urcrnrlat=35,llcrnrlon=-120, urcrnrlon=-80, resolution='c', area_thresh=1000.)

m.bluemarble()

m.drawcoastlines(linewidth=0.5)

m.drawcountries(linewidth=0.5)

m.drawstates(linewidth=0.5)

#Draw parallels and meridians

m.drawparallels(np.arange(10.,35.,5.))

m.drawmeridians(np.arange(-120.,-80.,10.))

m.drawmapboundary(fill_color='aqua')

#Open file whit numpy

data = np.loadtxt('path-tracks.csv', dtype=np.str,delimiter=',', skiprows=1)

latitude = data[:,0]

longitude = data[:,1]

#Convert latitude and longitude to coordinates X and Y

x, y = m(longitude, latitude)

#Plot the points on the map

pl.plot(x,y,'ro-')

pl.show()

绘制在地图上的点,对应于三条不同的路径. Mi最后的想法是画一条线连接与每条路径相关的点,我该怎么做?

是否可以为每条路径绘制标识符或标记?

我如何设置图形的大小,以便它可以区分点之间的分离?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值