matplotlib底图工具包热图

时间:2015-10-29 18:52:23

标签: python matplotlib heatmap matplotlib-basemap

我试图按照example来生成以下图片:

enter image description here

当我尝试加载数据时,我只获得enter image description here

我知道问题在于我的数据不是二进制,如我在使用的示例中所评论的那样,但这是唯一的原因吗?如果是问题,我不确定如何转换它。

这是我原始数据的一小部分样本。它是csv格式的long,lat格式。

-122.425891675136,37.7745985956747
-122.425891675136,37.7745985956747
-122.42436302145,37.8004143219856
-122.42699532676599,37.80087263276921
-122.438737622757,37.771541172057795
-122.40325236121201,37.713430704116
-122.423326976668,37.7251380403778
-122.371274317441,37.7275640719518
-122.508194031117,37.776601260681204
-122.419087676747,37.8078015516515
-122.419087676747,37.8078015516515
-122.487983072777,37.737666654332706
-122.41241426358101,37.7830037964534
-122.432914603494,37.7843533426568
-122.397744427103,37.7299346936044
-122.38369150395901,37.7431890419965
-122.412597377187,37.783932027727296
-122.421681531572,37.7428222004845
-122.38640086995301,37.738983491072
-122.412249767634,37.782556330202
-122.449389111284,37.7426688025766
-122.420272135283,37.7473316298785
-122.412249767634,37.782556330202
-122.412249767634,37.782556330202
-122.43604920358601,37.79984122288229
-122.41050925879499,37.786043222299206
-122.43101755702699,37.7873880712241
-122.42365634294501,37.7325564882065
-122.475773497852,37.744919069591
-122.49978712068999,37.74851760347229
-122.431046366089,37.7830295716044

1 个答案:

答案 0 :(得分:0)

当您从CSV文件中读取时,您会得到一个字符串列表。假设您有值string_lonstring_lat,请使用float(string_lon)float(string_lat)