def print_heatmap( points,label,id_map ):
'''
points: N_samples * N_features
label: (int) N_samples
id_map: map label id to its name
'''
# = sns.color_palette("RdBu_r", max(label)+1)
#cNorm = colors.Normalize(vmin=0,vmax=max(label)) #normalise the colormap
#scalarMap = cm.ScalarMappable(norm=cNorm,cmap='Paired') #map numbers to colors
index = [id_map[i] for i in label]
df = DataFrame(
points,
columns = list(range(points.shape[1])),
index = index
)
row_color = [current_palette[i] for i in label]
cmap = sns.cubehelix_palette(as_cmap=True, rot=-.3, light=1)
g = sns.clustermap( df,cmap=cmap,row_colors=row_color,col_cluster=False,xticklabels=False,yticklabels=False) #,standard_scale=1 )
return g.fig
评论列表
文章目录