上文继续
声明以下使用的包集合
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyecharts==0.5.10 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-countries-pypkg pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-provinces-pypkg pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-cities-pypkg pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-counties-pypkg pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-china-misc-pypkg pip install -i https://pypi.tuna.tsinghua.edu.cn/simple echarts-united-kingdom-pypkg pip install pyecharts_snapshot
创建【demo14.py】输入以下编码
from pyecharts import Geo keys = ['上海', '北京', '合肥', '哈尔滨', '广州', '成都', '无锡', '杭州', '武汉', '深圳', '西安', '郑州', '重庆', '长沙', '贵阳', '乌鲁木齐'] values = [4.07, 1.85, 4.38, 2.21, 3.53, 4.37, 1.38, 4.29, 4.1, 1.31, 3.92, 4.47, 2.40, 3.60, 1.2, 3.7] geo = Geo("全国主要城市空气质量热力图", "data from pm2.5", title_color="#fff",title_pos="left",width=1200,height=600,background_color='#404a59') geo.add("空气质量热力图", keys, values, visual_range=[0, 5], type='effectScatter',visual_text_color="#fff", symbol_size=15,is_visualmap=True, is_roam=True) geo.render(path="全国主要城市空气质量热力图.html")
效果图:
希望能对大家有所帮助。