Python-Pyecharts画图(热力图,仪表图,水球图)[三]

使用Pyecharts画图可以使图像富有动态

Scatter 散点图

Bar 柱状图

Pie 饼状图

Line折线图/面积图

Radar 雷达图

Sankey 桑葚图

WordCloud 词云图

Funnel 漏斗图

Gauge 仪表盘

Graph 关系图

Liquid 水球图

Parallel 平行坐标系

Polar 极坐标系

HeatMap 热力图

热力图

import random
from pyecharts import options as opts
from pyecharts.charts import HeatMap


def heatmap_car() -> HeatMap:
    x = ['宝马', '宾利', '奔驰', '奥迪', '丰田','大众', '特斯拉']
    y = ['中国','日本','南非','澳大利亚','阿根廷','阿尔及利亚','法国','意大利','加拿大']
    
    value = [[i, j, random.randint(0, 100)]
             for i in range(len(x)) for j in range(len(y))]
    c = (
        HeatMap()
        .add_xaxis(x)
        .add_yaxis("汽车", y, value)
        .set_global_opts(
            title_opts=opts.TitleOpts(title="HeatMap"),
            visualmap_opts=opts.VisualMapOpts(),
        )
    )
    return c

heatmap_car().render('G:/HTML图/热力图.html')

Python-Pyecharts画图(热力图,仪表图,水球图)[三]_第1张图片

仪表盘图

from pyecharts import charts

# 仪表盘
gauge = charts.Gauge()
gauge.add('Python小例子', [('Python机器学习', 30), ('Python基础', 70.),('Python正则', 90)])

gauge.render(path="G:/HTML图/仪表盘.html")
print('ok')

Python-Pyecharts画图(热力图,仪表图,水球图)[三]_第2张图片

水球图

from pyecharts import options as opts
from pyecharts.charts import Liquid, Page
from pyecharts.globals import SymbolType


def liquid() -> Liquid:
    c = (
        Liquid()
        .add("lq", [0.67, 0.30, 0.15])
        .set_global_opts(title_opts=opts.TitleOpts(title="Liquid"))
    )
    return c


liquid().render('G:/HTML图/水球图.html')


Python-Pyecharts画图(热力图,仪表图,水球图)[三]_第3张图片

谢谢点赞,评论!

你可能感兴趣的:(python,可视化Pyecharts,python,数据可视化)