Skip to content
Back to formatted view

Raw Message

Message-ID: <083A0C62-5967-4F02-9DBE-9812ED684AA8@comcast.net>
Date: 2009-03-17T16:38:20Z
From: David Winsemius
Subject: qqline plots outside plot area

I just executed the example in the R graph gallery for qqplot and it  
includes a call to qqline. It plots the line beyond the plotting  
region, unlike the illustration and unlike the behavior of any of the  
other "line" functions in my (limited) experience. the example on the  
help page for qqplot/qqline does the same. It does not appear that I  
have masked qqline with another package version.

y <- rt(200, df = 5)
qqnorm(y); qqline(y, col = 2)

-- 
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

 > sessionInfo()
R version 2.8.1 Patched (2009-01-19 r47650)
i386-apple-darwin9.6.0

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets   
methods   base

other attached packages:
[1] caret_4.08      UsingR_0.1-12   codetools_0.2-1 lattice_0.17-20  
Design_2.1-2    Hmisc_3.5-2     survival_2.34-1

loaded via a namespace (and not attached):
[1] cluster_1.11.12 grid_2.8.1      tools_2.8.1
 > qqline
function (y, datax = FALSE, ...)
{
     y <- quantile(y[!is.na(y)], c(0.25, 0.75))
     x <- qnorm(c(0.25, 0.75))
     if (datax) {
         slope <- diff(x)/diff(y)
         int <- x[1] - slope * y[1]
     }
     else {
         slope <- diff(y)/diff(x)
         int <- y[1] - slope * x[1]
     }
     abline(int, slope, ...)
}
<environment: namespace:stats>
 >