画相关性热图
- 數(shù)據(jù)格式如下
作圖代碼如下:
library(reshape2) library(ggplot2) library(RColorBrewer) x <- read.table("AllSamples.correlation.xls", sep = "\t", head = T) xx = as.matrix(x[,-1]) rownames(xx) = names(x)[-1] xx = melt(xx) names(xx)=c("Var1","Var2","pearson_value"); pdf("AllSamples.CorrelationHeatmap.pdf",width=9,height=9) ggplot(xx, aes(Var1, Var2, fill=pearson_value))+#geom_tile(width=0.8, height=0.8)+geom_tile(color='black')+geom_text(label=round(xx$pearson_value, 3))+scale_fill_gradient(low='#DEEBF7',high='#08519C')+theme(axis.text = element_text(angle=30, hjust=1,size=11,vjust=0,color='black'),panel.background = element_rect(fill='transparent'),panel.grid=element_line(color='grey'),legend.title = element_text(size = 13))+labs(x="",y="") dev.off()- 圖片效果如下
?
轉(zhuǎn)載于:https://www.cnblogs.com/raisok/p/11010421.html
總結(jié)
- 上一篇: Sitecore 9 为什么数据驱动的组
- 下一篇: 2020南大计科考研实记(受难三跨)