【python】使用pyheatmap.heatmap绘制热力图,入门版2

python使用pyheatmap.heatmap制作热力图,代码传送门:

# -*- coding: utf-8 -*-
from pyheatmap.heatmap import HeatMap
import numpy as np
N = 10000
X = np.random.rand(N) * 255  # [0, 255]
Y = np.random.rand(N) * 255
data = []
for i in range(N):
  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") #热图

效果图:

posted @ 2020-03-05 10:48  HelenLee01  阅读(713)  评论(0编辑  收藏  举报