pyecharts第十节、地图(一、世界地图)

2022-11-29 19:23:56 浏览数 (1)

需要的包

代码语言:javascript复制
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

安装的比较多,安装完成别着急操作,需要解压配置以下,自动的哦。 

创建【demo10.py】测试类

输入以下编码

代码语言:javascript复制
from pyecharts import Map

value = [95.1, 23.2, 43.3, 66.4, 88.5]

attr = ["China", "Canada", "Brazil", "Russia", "United States"]

map0 = Map("世界地图示例", width=1200, height=600)

map0.add("世界地图", attr, value, maptype="world",  is_visualmap=True, visual_text_color='#000')

map0.render(path="allWord.html")

执行

打开生成的【allWord.html】文件

双击打开

效果图 

0 人点赞