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实现省市热力地图_第1张图片

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实现省市热力地图_第2张图片 

你可能感兴趣的:(编程练习)