利用Pytecharts中Geo模塊中的maptype繪制地圖

1、 maptype = 省份

from pyecharts import Geo

data = [('汕頭',50),('汕尾市',60),('陽江市',70)]

geo = Geo('廣東省空氣質量','data from pm 2.5',

? ? ? ? ? title_color = '#fff',

? ? ? ? ? title_pos = 'center',

? ? ? ? ? width = 1200,

? ? ? ? ? height = 800,

? ? ? ? ? background_color='#404a459')

attr,value = geo.cast(data)

geo.add('',attr,value,

? ? ? ? maptype? = '廣東',#默認是china

? ? ? ? type = 'effectScatter',

? ? ? ? is_random = True,

? ? ? ? effct_scale=5,

? ? ? ? is_legend_show=False)

geo.render('20.廣東空氣質量.html')


廣東省散點地圖繪制實例

2、maptype = 中國

from pyecharts import Geo

data = [('北京',50),('上海',60),('深圳',70),('臺灣',100)]

geo = Geo('全國空氣質量','data from pm 2.5',

? ? ? ? ? title_color = '#fff',

? ? ? ? ? title_pos = 'center',

? ? ? ? ? width = 1200,

? ? ? ? ? height = 800,

? ? ? ? ? background_color='#404a459')

attr,value = geo.cast(data)

geo.add('',attr,value,

? ? ? ? maptype? = 'china',

? ? ? ? type = 'effectScatter',

? ? ? ? is_random = True,

? ? ? ? effct_scale=5,

? ? ? ? is_legend_show=False)

geo.render('21.全國空氣質量.html')


中國散點地圖繪制實例

3、maptype = 某市區(qū)

接下來的代碼和上面有異曲同工之妙哦!相信你一定可以將進行舉一反三的。

?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容