服务热线
178 0020 3020
library(ggplot2)
library(plyr)
require(reshape2)
require(scales)
heat_mir<-read.table("2.csv",header = T,sep = ",")
head(heat_mir)
heat_mir$Name <- with(heat_mir, reorder(ID, CL))
head(heat_mir)
heat.m<-melt(heat_mir)#id(即var.ids)和 观测值(即measure.vars)这两个参数可以只指定其中一个剩余的列被当成另外一个参数的值;如果两个都省略,数值型的列被看成观测值
heat.m<-ddply(heat.m,.(variable),transform,label=rescale(value,to=c(-5,5)))
p <- ggplot(heat.m, aes(variable, Name)) +
geom_tile(aes(fill = label),colour = "white") +
scale_fill_gradient(low = "orange",high = "red") +
labs(x="",y="miRNA ID",title="R2-12")
p
#use pheatmap 感觉还是这个容易点啊
library(pheatmap)
heat_text<-read.table("2.csv",header = T,sep = ",")
head(heat_text)
row.names(heat_text)<-heat_text$ID
head(heat_text)
heat_text<-heat_text[,2:5]
head(heat_text)
heat_m<-data.matrix(heat_text)
pheatmap(heat_m,scale = "column",
cluster_rows = TRUE,cluster_cols = FALSE,
display_numbers=T)
附件