ggplot2叠加不同图层

数据sample

flanking mean sd CNV
0 365 15 955
100 367 15 1018
200 369 15.1 1025
300 370 15.1 1027
400 372 15.2 1031
500 373 15.3 1032
600 375 15.3 1033
700 377 15.3 1034
800 378 15.4 1034
900 380 15.4 1037

a=read.table("SDandCNV.txt",header=T)
lilbrary("ggplot2")
pd <- position_dodge(.1) 
layer1=ggplot(a,aes(flanking,mean))+geom_point(position=pd,size=3)+geom_errorbar(aes(ymin=mean-sd,ymax=mean+sd),width=0.1,position=pd)+geom_line(position=pd)
layer2=geom_line(aes(y=CNV))
layer3=geom_point(aes(y=CNV),shape=1)
layer1+layer2+layer3

 

posted on 2015-01-21 21:40  云中道长  阅读(4229)  评论(0编辑  收藏  举报

导航