seaborn ---- 绘制热力图
程序员文章站
2022-07-14 10:06:13
...
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
data = np.random.rand(4,3)*10
fig, ax = plt.subplots(figsize = (12,9))
sns.heatmap(np.round(data,2), annot=True, vmax=10,vmin = 0, linewidths=.5, xticklabels= ['a', 'b', 'c'], yticklabels= ['1', '2', '3', '4'], square=True, cmap="YlGnBu")
ax.set_title('heatmap', fontsize = 18)
ax.set_ylabel('number', fontsize = 18)
ax.set_xlabel('letter', fontsize = 18)
上一篇: Seaborn绘制热力图