欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

python实现省市热力地图

程序员文章站 2022-06-09 20:18:14
...
from pyecharts.charts import Map
from pyecharts import options as opts
from pyecharts.globals import ThemeType

value = ['78','17','101','95','36','16','19','23','35']
attr = ['福州市','莆田市','泉州市','厦门市','漳州市','龙岩市','三明市','南平市','宁德市']
sequence = list(zip(attr,value))

def map_visualmap(sequence,year) -> Map:
    c = (
        Map()
        .add(year,sequence, "福建",)
        .set_global_opts(
            title_opts=opts.TitleOpts(title="地图"),
            visualmap_opts=opts.VisualMapOpts(max_=101,min_=16),
#             visualmap_opts=opts.VisualMapOpts(max_=101,range_color=["lightskyblue", "yellow", "orangered"]),
        )
    )
    return c

map = map_visualmap(sequence,'2020')
map.render(path='./test.html')

python实现省市热力地图

from pyecharts.charts import Map
from pyecharts import options as opts
from pyecharts.globals import ThemeType

value = ['78','17','101','95','36','16','19','23','35']
attr = ['福州市','莆田市','泉州市','厦门市','漳州市','龙岩市','三明市','南平市','宁德市']
sequence = list(zip(attr,value))

def map_visualmap(sequence,year) -> Map:
    c = (
        Map()
        .add(year,sequence, "福建",)
        .set_global_opts(
            title_opts=opts.TitleOpts(title="地图"),
#             visualmap_opts=opts.VisualMapOpts(max_=101,min_=16),
            visualmap_opts=opts.VisualMapOpts(max_=101,range_color=["lightskyblue", "yellow", "orangered"]),
        )
    )
    return c

map = map_visualmap(sequence,'2020')
map.render(path='./test.html')

 

python实现省市热力地图 

相关标签: 编程练习