pythonic生物人

Python heatmap也毫不逊色R

分享几款配色,搬走搬走,求个三连~~~

小编自调色系

sns.set(rc={"font.family": "Songti SC"})

g = sns.clustermap(
    data=gene.corr(),
    dendrogram_ratio=(0.1, 0.1),
    figsize=(7, 7),
    annot=True,
    fmt=".2f",
    cmap=sns.diverging_palette(255, 5, as_cmap=True),
)
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(), rotation=90)
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(), rotation=0)
plt.show()

Image

绿色系

sns.set(rc={"font.family": "Songti SC"})

g = sns.clustermap(
    data=gene.corr(),
    dendrogram_ratio=(0.1, 0.1),
    figsize=(7, 7),
    annot=True,
    fmt=".2f",
    cmap="Greens", #绿色系
)
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(), rotation=90)
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(), rotation=0)
plt.show()

Image

蓝色系

sns.set(rc={"font.family": "Songti SC"})

g = sns.clustermap(
    data=gene.corr(),
    dendrogram_ratio=(0.1, 0.1),
    figsize=(7, 7),
    annot=True,
    fmt=".2f",
    cmap="Blues",#蓝色系
)
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(), rotation=90)
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(), rotation=0)
plt.show()

Image

紫色系

sns.set(rc={"font.family": "Songti SC"})

g = sns.clustermap(
    data=gene.corr(),
    dendrogram_ratio=(0.1, 0.1),
    figsize=(7, 7),
    annot=True,
    fmt=".2f",
    cmap="Purples_r",#紫色系
)
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(), rotation=90)
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(), rotation=0)
plt.show()

Image

混色系1

sns.set(rc={"font.family": "Songti SC"})

g = sns.clustermap(
    data=gene.corr(),
    dendrogram_ratio=(0.1, 0.1),
    figsize=(7, 7),
    annot=True,
    fmt=".2f",
    cmap="BuGn_r",#混色系1
)
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(), rotation=90)
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(), rotation=0)
plt.show()

Image

混色系2

sns.set(rc={"font.family": "Songti SC"})

g = sns.clustermap(
    data=gene.corr(),
    dendrogram_ratio=(0.1, 0.1),
    figsize=(7, 7),
    annot=True,
    fmt=".2f",
    cmap="Greys_r",#混色系2
)
g.ax_heatmap.set_xticklabels(g.ax_heatmap.get_xticklabels(), rotation=90)
g.ax_heatmap.set_yticklabels(g.ax_heatmap.get_yticklabels(), rotation=0)
plt.show()

Image

-END-
推荐阅读:

Image

我的学习小圈子👉
加入

Image

赞、在看就是最大的支持Image