【Python】DAY06学习日记,哎,没意思,我还是做饭去吧

原本想把常用的图都整理出来,写着写着跑去找参数的含义,找着找着发现......官方文档整理得明明白白嘛,还要我干什么用。

没劲,每个月总有那么二十几天不想动弹。

一想到还要学spring,心态都崩了。

做饭去。

放个代码证明我来过。

# 根据Excel表格里的数据制作图

import pandas as pd
from pyecharts import Geo, GeoLines, Style

# 读文件
from pyecharts.echarts import style


def readExcel():
    data = pd.read_excel('数据.xlsx', 'Sheet1')
    global attr
    attr = data.attr
    global value
    value = data.value


readExcel()

'''中国地图系列'''


# 01:热力图
# [各参数的意义](http://www.python88.cn/art/18674/)
def chinaCityHeatMap():
    geo = Geo("----热力图",  # 大标题
              title_color="#303843", title_pos='center',  # 大标题颜色和位置
              width=1200, height=600,  # 画布宽高
              background_color='#404A59'  # 画布背景颜色
              )
    geo.add("统计指标", attr, value, type='heatmap',  # 作图类型为热力图
            is_random=True,
            visual_range=[0, 20],  # 视程
            visual_text_color="#fff",  # 统计指标(第一个参数)的颜色
            legend_pos='right',  # 统计指标靠右
            is_visualmap=True,
            is_roam=True)  # 是否开启鼠标缩放和平移漫游

    geo.render(path="----热力图.html")


# 02:散点图
def chinaScatterMap():
    geo = Geo("----散点图", title_color="#fff", title_pos="center", width=1200, height=600,
              background_color='#404a59')
    geo.add("统计指标", attr, value, type="scatter", maptype='china', is_random=True,
            visual_range=[0, 20], visual_text_color="#fff", symbol_size=15, is_visualmap=True, is_roam=True)
    geo.render("----散点图.html")


chinaScatterMap()


# 03:发散性散点图
def chinaEffectScatterMap():
    geo = Geo("----发散性散点图", title_color="#fff", title_pos="center", width=1200, height=600,
              background_color='#404a59')
    geo.add("统计指标", attr, value, type="effectScatter", maptype='china', is_random=True, effect_scale=8,
            visual_range=[0, 20], visual_text_color="#fff",symbol_size=10, is_visualmap=True, is_roam=True)
    geo.render("----发散性散点图.html")


chinaEffectScatterMap()

# 算了 放个官方文档在这里吧
# [官方文档](https://pyecharts.org/#/zh-cn/render_images)

你可能感兴趣的:(【Python】DAY06学习日记,哎,没意思,我还是做饭去吧)