python程序可視化探索:讓pyecharts更易用

 

'''
Created by freepy.
2020/5/29 19:43:48
'''

import os
from pyecharts import options as opts
from pyecharts.charts import Map
import pandas as pd


s_series_name = '###[name:edit1,type:edit,label:圖表名稱,text:好用的pyecharts,width:200,top:40,left:140,]###'
s_maptype = '###[name:edit2,type:edit,label:地圖類型,text:china,width:200,top:70,left:140,]###'
s_label = '###[name:edit3,type:edit,label:標題,text:GDP,width:200,top:100,left:140,]###'
s_data_file = '###[name:edit4,type:edit,label:excel文件,text:datain/分省GDP.xlsx,width:300,top:140,left:140,]###'


data_di = pd.read_excel(s_data_file, sheet_name=0, encoding='gbk')

bb = data_di.values.tolist()

c = (
    Map()
    .add(s_label,  bb, "china")
    .set_global_opts(
        title_opts=opts.TitleOpts(title=s_series_name),
        visualmap_opts=opts.VisualMapOpts(max_=110000, is_piecewise=True),
    )
    .render("../map_visualmap_piecewise.html")
)

os.system(c)

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章