Pyecharts 绘制动态流线地图

from pyecharts import options as opts 
from pyecharts.charts import Geo # 地理坐标系绘制方法
from pyecharts.globals import GeoType,ThemeType,SymbolType #Geo图的类型 主题 涟漪图形符号
data=[("四川","8302"),("山东","10006"),("河南","9559"),("湖南","6860"),("广东","11169")]
geo = (
    Geo(init_opts=opts.InitOpts(width="600px",height="500px",theme=ThemeType.DARK))  
    .add_schema(maptype="china",
                itemstyle_opts=opts.ItemStyleOpts(color='white',border_color="#EE2C2C"),#地图背景色
                zoom=1.5,
                is_roam=True,
                center=Geo().get_coordinate('广东'),  # 视角中心
                emphasis_itemstyle_opts=opts.ItemStyleOpts(color="#31708f"),  # 高亮颜色
                emphasis_label_opts=opts.ItemStyleOpts(color="white", )  # 字体颜色
               )
    
    .add("",
         data,
         type_=GeoType.EFFECT_SCATTER,
         symbol_size=6
        )
    
    .add("",
         [("广东","四川"),("广东","山东"),("广东","湖南"),("广东","河南")],
         type_=GeoType.LINES, 
         effect_opts=opts.EffectOpts(symbol=SymbolType.ARROW,symbol_size=6,color='#5f99bb'),
         linestyle_opts=opts.LineStyleOpts(curve=0.2,color="#B0E2FF"))
    .set_series_opts(label_opts=opts.LabelOpts(is_show=False))  
    .set_global_opts(title_opts=opts.TitleOpts(title="广东出发的航班",subtitle="数据来源:中国民航局官方网站",pos_right="center",pos_top="5%")) 
)
geo.render_notebook()

 

 

posted @ 2021-07-06 10:08  脱离低级趣味  阅读(526)  评论(0编辑  收藏  举报