[R] plot xy data

sutada Mungpakdee msutada at gmail.com
Sat Nov 26 05:27:30 CET 2011


Hi,

Has anyone know about how to get the correct plot?

I have use this R script (as below), so I expect the plot is based on x axis, but the result was opposite. Any suggestion will be great.

library(IRanges)
data <-read.table(file="~/q20snpref/illusmp454merbed",sep="\t",header=F)
colnames(data)<-c("Scaffold","sca_position","coverage")
depth<-mean(data[,"coverage"])
#depth now has the mean (overall)coverage
#set the bin-size
window<-10001 
rangefrom<-0
rangeto<-length(data[,"sca_position"])
data.10kb<-runmed(data[,"coverage"],k=window)
png(file="cov_10k.png",width=1000,height=1000)
plot(x=data.10kb[rangefrom:rangeto],y=data[rangefrom:rangeto,"sca_position"],pch=".",cex=1,xlab="depth",ylab="bp_position",type="p")
dev.off()

Best regards,
Sutada


More information about the R-help mailing list