一、为什么需要动态地图
动态地图是反映自然和人文现象变迁和运动的地图,
可以根据时间或地域的变化展现出某件事情的发展规律,pyecharts画出动态地图。
二、导入数据(虚拟数据)
import pyecharts.options as opts
from pyecharts.globals import ThemeType
from pyecharts.commons.utils import JsCode
from pyecharts.charts import Timeline,Map
data = [
{
"time": 1980,
"data": [
{
"name": "台湾", "value": [633.76, 12.28, "台湾"]},
{
"name": "香港", "value": [432.47, 8.38, "香港"]},
{
"name": "江苏", "value": [319.8, 6.2, "江苏"]},
{
"name": "上海", "value": [311.89, 6.05, "上海"]},
{
"name": "山东", "value": [292.13, 5.66, "山东"]},
{
"name": "辽宁", "value": [281, 5.45, "辽宁"]},
{
"name": "广东", "value": [249.65, 4.84, "广东"]},
{
"name": "四川", "value": [229.31, 4.44, "四川"]},
{
"name": "河南", "value": [229.16, 4.44, "河南"]},
{
"name": "黑龙江", "value": [221, 4.28, "黑龙江"]},
],
},
{
"time": 2000,
"data": [
{
"name": "台湾", "value": [633.76, 12.28, "台湾"]},
{
"name": "香港", "value": [732.47, 8.38, "香港"]},
{
"name": "江苏", "value": [719.8, 6.2, "江苏"]},
{
"name": "上海", "value": [811.89, 6.05, "上海"]},
{
"name": "山东", "value