ggplot2只能對(duì)數(shù)據(jù)框進(jìn)行操作
a<-read.table("BRCA.temp.txt",head=T,sep="\t")##讀入數(shù)據(jù)框
require(reshape2);
require(ggplot2);

b<-melt(a)#用reshape2的melt一下,轉(zhuǎn)換為標(biāo)準(zhǔn)的數(shù)據(jù)框


#我們想要畫的圖是橫坐標(biāo)為Normal、S1、S2、S3、S4、Early、Advance,縱坐標(biāo)為其共表達(dá)系數(shù),填色根據(jù)時(shí)期區(qū)分
p<-ggplot(b,aes(x=variable,y=value))+geom_boxplot(aes(fill=variable))##橫坐標(biāo)、縱坐標(biāo)、填色

p?<-?p?+?xlab("Stage")?+?ylab("R2")?+?ggtitle("BRCA") +guides(fill=guide_legend(title="Legend_Title"))
