【python】使用pyheatmap.heatmap制作热力图,入门版
使用pyheatmap.heatmap制作热力图:
# -*- coding: utf-8 -*-
from pyheatmap.heatmap import HeatMap
import numpy as np
x = [10,20,30,80,50,40,70,90,60,30,40,50]
y = [50,40,20,30,60,90,60,20,60,10,70,50]
data = []
for i in range(0,11):
tmp = [int(x[i]), int(y[i]),1]
data.append(tmp)
heat = HeatMap(data)
heat.clickmap(save_as="1.png") #点击图
heat.heatmap(save_as="2.png") #热图
效果图: