在地图上使用pycharts绘图坐标

时间:2018-11-15 03:47:32

标签: python python-3.x

我使用csv文件中的坐标在地图上绘图。但是在地图上只有一点。

from pyecharts import Geo
import pandas as pd

df=pd.read_csv(r"C:\157.csv")     
df.head()

geo_cities_coords={i:[df.iloc[i]["Lon"],df.iloc[i]["Lat"]] for i in range(len(df))}  

print(geo_cities_coords)
attr=list(df["City"])
value=list(df["Days"]/100000)

geo = Geo("Title", "subtitle", title_color="#fff", title_pos="center",width=1200, height=600, background_color='#404a59')

     geo.add("",attr,value,visual_range=[0,100],symbol_size= 5,
    visual_text_color= "#fff",is_piecewise = True,
    is_visualmap= True,maptype = '北京', visual_split_number= 10,
    geo_cities_coords=geo_cities_coords)

  geo.render( 'test.html')

CSV文件格式:

City,Lat,Lon,Days
1,39.97556667,116.33035,39201.35731
2,39.97545,116.3302333,39201.35903
3,39.97383333,116.3329667,39201.52389

This is what I got

0 个答案:

没有答案