安装 pycharts ,一定要安装0.1.9.4的,不然其他的错误我也不知道
pip install pyecharts == 0.1.9.4
地图包
全球国家地图: echarts-countries-pypkg (1.9MB)
中国省级地图: echarts-china-provinces-pypkg (730KB)
中国市级地图: echarts-china-cities-pypkg (3.8MB)
pip install echarts-countries-pypkg
pip install echarts-china-provinces-pypkg
pip install echarts-china-cities-pypkg
pip install echarts-countries-pypkg
pip install echarts-china-provinces-pypkg
pip install echarts-china-cities-pypkg
pip install echarts-china-counties-pypkg
from pyecharts import Barimport randomattr = ["{}天".format(i) for i in range(30)]
v1 = [random.randint(1, 30) for _ in range(30)]
bar = Bar("Bar - datazoom - slider 示例")
bar.add("", attr, v1, is_label_show=True, is_datazoom_show=True)
bar.render('bar_slider.html')
from pyecharts import Map
value = [220, 193, 255,277, 365,98,145,456,120,160,490]attr = ['杭州市','宁波市','温州市','绍兴市','湖州市','嘉兴市','金华市','衢州市','舟山市','台州市','丽水市']map = Map("浙江数据表现", width=1200, height=600)map.add("", attr, value, maptype='浙江',visual_range=[0, 200], is_visualmap=True, visual_text_color='#000')map.render('m.html')
from pyecharts import Map
value = [1,1,1,1,1,1,1,1,1,1,1]attr = ['杭州市','宁波市','温州市','绍兴市','湖州市','嘉兴市','金华市','衢州市','舟山市','台州市','丽水市']map = Map("浙江数据表现", width=1200, height=600)map.add("", attr, value, maptype='浙江',visual_range=[0, 200], is_visualmap=True, visual_text_color='#000')map.render('mh.html')
from pyecharts import Mapvalue = [155, 10, 66, 78, 33, 80, 190, 53, 49.6]
attr = ["福建", "山东", "北京", "上海", "甘肃", "新疆", "河南", "广西", "西藏"]
map = Map("Map 结合 VisualMap 示例", width=1200, height=600)
map.add("统计各省人口数",attr,value,maptype='china',is_visualmap=True, #结合体VisualMapvisual_text_color='#000'
)
map.render('mchnia.html')
from pyecharts import Mapvalue = [155, 10, 66, 78, 33, 80, 190, 53, 49.6]
attr = ["福建", "山东", "北京", "上海", "甘肃", "新疆", "河南", "广西", "西藏"]
map = Map("Map 结合 VisualMap 示例", width=1200, height=600)
map.add("统计各省人口数",attr,value,maptype='china',is_visualmap=True, #结合体VisualMapvisual_text_color='#000'
)
map.render('mchnia.html')
from pyecharts import WordCloud
name =['Sam S Club', 'Macys', 'Amy Schumer', 'Jurassic World', 'Charter Communications', 'Chick Fil A', 'Planet Fitness', 'Pitch Perfect', 'Express', 'Home', 'Johnny Depp', 'Lena Dunham', 'Lewis Hamilton', 'KXAN', 'Mary Ellen Mark', 'Farrah Abraham', 'Rita Ora', 'Serena Williams', 'NCAA baseball tournament', 'Point Break']
value =[10000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555, 550, 462, 366, 360, 282, 273, 265]
wordcloud =WordCloud(width=1300, height=620)
wordcloud.add("", name, value, word_size_range=[30, 100], shape='diamond')
wordcloud.render('11.html')
更多见:pyecharts