从同一数据帧创建多个Seaborn重叠的热图

时间:2020-09-03 21:49:01

标签: python pandas numpy seaborn heatmap

数据框是下一个:

Dataframe

numpy = np.zeros((df.x.max()+1, df.y.max()+1))
numpy[df.x, df.y] = df.Value
plt.figure(figsize=(14, 7))
heatmap = sns.heatmap(numpy.T, cmap="Blues", xticklabels=False, yticklabels=False).get_figure().savefig("world_heatmap.png", dpi=300)

numpy1= np.zeros((df.x.max()+1, df.y.max()+1))
numpy1[df.x, df.y] = df.Appearance_percentage
probheatmap = sns.heatmap(numpy1.T, cmap="Blues", xticklabels=False, yticklabels=False).get_figure().savefig("world_probheatmap.png", dpi=300)

numpy2 = np.zeros((df.x.max()+1, df.y.max()+1))
numpy2[df.x, df.y] = df.Few_clouds
bestzonesheatmap = sns.heatmap(numpy2.T, cmap="Blues", xticklabels=False, yticklabels=False).get_figure().savefig("world_bestzonesheatmap.png", dpi=300)

有了这些,我得到了:

Hm1

Hm2

Hm3

如您所见,每个热图就像重叠另一个热图。有人知道我在做什么错吗?谢谢!!!!! <3

PD:热图还可以,在每个热图旁边可以看到的是错误的。

0 个答案:

没有答案