美文网首页
ggplot2之boxplot

ggplot2之boxplot

作者: 白云梦_7 | 来源:发表于2018-07-10 09:43 被阅读0次

ggplot2只能对数据框进行操作

a<-read.table("BRCA.temp.txt",head=T,sep="\t")##读入数据框

require(reshape2);

require(ggplot2);

b<-melt(a)#用reshape2的melt一下,转换为标准的数据框

#我们想要画的图是横坐标为Normal、S1、S2、S3、S4、Early、Advance,纵坐标为其共表达系数,填色根据时期区分

p<-ggplot(b,aes(x=variable,y=value))+geom_boxplot(aes(fill=variable))##横坐标、纵坐标、填色

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

相关文章

网友评论

      本文标题:ggplot2之boxplot

      本文链接:https://www.haomeiwen.com/subject/awtfpftx.html