赞
踩
from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.faker import Faker
c = (
Map()
.add("商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china")
.set_global_opts( title_opts=opts.TitleOpts(title="Map-VisualMap(分段型)"), visualmap_opts=opts.VisualMapOpts(max_=200, is_piecewise=True), )
.render("map_visualmap_piecewise.html") )
官方原码
map = (
Map()
.add("", [list(z) for z in zip(data['省份'].value_counts().reset_index()['index'].tolist(),data['省份'].value_counts().tolist())], "china",is_map_symbol_show=False,)
.set_global_opts(title_opts=opts.TitleOpts(title="参加调研的各省份高校个数"),
visualmap_opts=opts.VisualMapOpts(max_=15, is_piecewise=True))
)
map.render_notebook()#在notebook上显示
data['省份'].value_counts().reset_index()['index'].tolist(),省份的list类型数据
data['省份'].value_counts().tolist(),对应的值的list类型数据
max_,自己数据的最大值
is_map_symbol_show=False,不显示红点
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。