How to express classes on the axis of a heatmap in Seaborn

前端 未结 3 1190
走了就别回头了
走了就别回头了 2020-12-01 02:13

I created a very simple heatmap chart with Seaborn displaying a similarity square matrix. Here is the one line of code I used:

sns.heatmap(sim_mat, linewidth         


        
3条回答
  •  感动是毒
    2020-12-01 02:55

    When both dendrograms are used one can also add a new hidden axis and draw the legend.

    ax= f.add_axes((0,0,0,0))
    ax.xaxis.set_visible(False)
    ax.yaxis.set_visible(False)
    
    for label in node_labels.unique():
        ax.bar(0, 0, color=node_lut[label], label=label, linewidth=0)
    
    l2 = g.ax_row_dendrogram.legend(title='Node', loc="center", ncol=2, bbox_to_anchor=(0.8, 0.8), bbox_transform=f.transFigure)
    

提交回复
热议问题