[R-SIG-Mac] qqline plots outside plot area

David Winsemius dwinsemius at comcast.net
Tue Mar 17 17:38:20 CET 2009

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)


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>

More information about the R-SIG-Mac mailing list