热图-我要鲜明的对比

以下是我要画的热图

但实际,相同数据,我画出来,它长这样子

TF_matrix=t(scale(t(TF_matrix)))
annotation_col = data.frame(CellType = factor(rep(c("NSCLC", "SCLC"), c(68,37))))
rownames(annotation_col)<-colnames(nrDEG)
pheatmap(TF_matrix,annotation_col=annotation_col,labels_col = '',cluster_cols = FALSE)

之前我觉得,图画出来就好了
但其实
合理性、对比鲜明、美观这些因素,如果只是捎带手的事儿,为什么不做好呢?
  • 对比不鲜明,正常来说,正负值的对比应是鲜明的,由于单个较大或较小值的存在会造成其他数值的热图颜色对比不鲜明所以,一般会有阈值的设定,阈值一般是2和-2,3和-3这样对称着来的;

  • annotation_col那里是连成一片的,其实是,行太多,画布大小的问题,所以直接出的图各列之间是没有边界的;

略微改良以后,出图如下

TF_matrix=t(scale(t(TF_matrix)))
TF_matrix[TF_matrix>2]=2
TF_matrix[TF_matrix< -2] = -2
annotation_col = data.frame(CellType = factor(rep(c("NSCLC", "SCLC"), c(68,37))))
rownames(annotation_col)<-colnames(nrDEG)
pheatmap(TF_matrix,annotation_col=annotation_col,labels_col = '',cluster_cols = FALSE, cellwidth = 3, cellheight = 15,filename = 'test.png')

(0)

相关推荐