1. 程式人生 > >練習六十八:pyecharts模塊練習

練習六十八:pyecharts模塊練習

info div -i left htm echart 2-2 render right

用一個地圖顯示最熱的幾個城市溫度

代碼(用Geo模塊)

from pyecharts import Geo

attr = ["西安","上海","蘇州","成都","海南","南京"]
value = [28,15,16,26,31,23]
geo = Geo("溫度表圖")
geo.add("",attr,value,type="effectScatter",border_color="#ffffff",symbol_size=20,
        is_label_show=True,label_text_color="#00FF00",symbol="circle",
        symbol_color="ff0000
",geo_normal_color="#006edd",geo_emphasis_color="#0000ff") # geo.show_config() # geo.render() #默認將在當前目錄中生成render.html,也看自定義文件名稱:geo.render("testhtml.html") geo #直接顯示在notebook上

結果

技術分享圖片

代碼(用Map模塊):

from pyecharts import Map

areas = [‘廣東‘,‘廣西‘,‘湖南‘,‘江西‘,‘福建‘]
values = [28,15,16,26,31]
test_map = Map("test")
test_map.add
("", areas, values, maptype=‘china‘, is_visualmap=True, visual_text_color=‘#000‘, is_label_show=True) test_map #notebook上

結果

技術分享圖片

練習六十八:pyecharts模塊練習