%matplotlib inline
import numpy as np
import pandas as pd
import seaborn as sns
uniform_data = np.random.rand(3,3)
print(uniform_data)
heatmap = sns.heatmap(uniform_data) #3x3矩阵热力图表现
[[0.42899731 0.39260745 0.58101009] [0.1538906 0.42498579 0.28899658] [0.68043676 0.40942948 0.33891072]]
ax = sns.heatmap(uniform_data,vmin=.2,vmax=.5)
设置调色板最大值和最小值
normal_data = np.random.randn(3,3) #这样初始化的矩阵有正有负 randn()
print(normal_data)
ax = sns.heatmap(normal_data,center=0) #center=0 对于有正有负的数据而言颜色差异更大