Hi Ana, I should clarify what I wrote in the previous email. You are expecting an approximately square plot with a line running at about an angle of 45 degrees from lower left to upper right. However, the range of x and y values that you are plotting are not approximately equal. This means that lines with a slope of 1 will not run from corner to corner or even parallel such a line. I hope that explains it better.
Jim On Sat, Feb 29, 2020 at 9:54 AM Jim Lemon <drjimle...@gmail.com> wrote: > > Hi Ana, > I'll do my best. In the attached image, I have placed two green disks > at (0,0) and (1,1). These points are on a line with intercept 0 and > slope 1 as are all the other points on that line. When you ask for an > abline with two unnamed arguments, the first is the intercept and the > second is the slope. The abline function them draws a line with these > values across the plot. So it has done what you asked. If you specify > xlim=c(0,1) in the initial plot, you will get what you expect, but you > will leave all x values greater than 1.04 off the plot. > > Jim > > On Sat, Feb 29, 2020 at 8:41 AM Ana Marija <sokovic.anamar...@gmail.com> > wrote: > > > > Hi Jim, > > > > I have in my code: > > abline(0,1,col='red') > > > > can you please tell me how to change my code to have it indeed running > > from 0 to 1? > > > > Thanks > > Ana > > > > On Fri, Feb 28, 2020 at 3:34 PM Jim Lemon <drjimle...@gmail.com> wrote: > > > > > > Hi Ana, > > > Look carefully at that red line. It goes through (0,0) and scoots off > > > the plot at (2.5,2.5). As you have specified that intercept and slope > > > in your code, poor abline is doing the best it can. Do not punish it > > > for doing what you request. > > > > > > Jim > > > > > > On Sat, Feb 29, 2020 at 6:10 AM Ana Marija <sokovic.anamar...@gmail.com> > > > wrote: > > > > > > > > Hello, > > > > > > > > I made the plot in attach with this function: > > > > > > > > qqunif = function(p, BH=T, MAIN = " ", SUB=" ") > > > > { > > > > nn = length(p) > > > > xx = -log10((1:nn)/(nn+1)) > > > > plot( xx, -sort(log10(p)), > > > > main = MAIN, sub= SUB, cex.sub=1.3, > > > > xlab=expression(Expected~~-log[10](italic(p))), > > > > ylab=expression(Observed~~-log[10](italic(p))), > > > > cex.lab=1.0,mgp=c(2,1,0)) > > > > abline(0,1,col='red') > > > > if(BH) ## BH = include Benjamini Hochberg FDR > > > > { > > > > > > > > abline(-log10(0.05),1, col='black',lty=1) > > > > text(0.5,1.9 , "FDR=0.05", col = "gray60",srt=20, cex=1) > > > > abline(-log10(0.10),1, col='black',lty=1) > > > > text(0.5, 1.6, "FDR=0.10", col = "gray60",srt=20, cex=1) > > > > abline(-log10(0.25),1, col='black',lty=1) > > > > text(0.5, 1.2, "FDR=0.25", col = "gray60",srt=20, cex=1) > > > > #legend('topleft', c("FDR = 0.05","FDR = 0.10","FDR = 0.25"), > > > > #col=c('black','black','black'),lty=c(1,1,1), cex=0.8) > > > > if (BF) > > > > { > > > > abline(h=-log10(0.05/nn), col='black') ## bonferroni > > > > } > > > > } > > > > } > > > > > > > > > > > > biob272=read.table("/Users/ams/Desktop/biobank272LD.txt") > > > > qqunif(biob272$V2) > > > > > > > > > > > > > head(biob272) > > > > V1 V2 > > > > 1 rs2089177 0.581204 > > > > 2 rs4360974 0.418456 > > > > 3 rs6502526 0.416670 > > > > 4 rs8069906 0.568030 > > > > 5 rs9895995 0.266746 > > > > 6 rs9905280 0.510032 > > > > > > > > But the red, abline doesn't look like it is 1:1 line. > > > > > > > > Can you please advise? > > > > > > > > Thanks > > > > Ana > > > > ______________________________________________ > > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > > PLEASE do read the posting guide > > > > http://www.R-project.org/posting-guide.html > > > > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.