[R-SIG-Mac] stupid question on abline

Steven McKinney smckinney at bccrc.ca
Thu Sep 16 21:10:31 CEST 2010


Hi Steven,

Try

abline(a = -1905/2, b = 0.5)

R is "drawing" abline(a = 0, b = 0.5) but it is entirely off the screen as the x limits are 1900 to 1910.

It appears that abline only works for b = 0 as those were your only attempts that yielded
a line within the plot frame.

Steven McKinney

________________________________________
From: r-sig-mac-bounces at stat.math.ethz.ch [r-sig-mac-bounces at stat.math.ethz.ch] On Behalf Of steven mosher [moshersteven at gmail.com]
Sent: September 16, 2010 12:04 PM
To: r-sig-mac at stat.math.ethz.ch
Subject: [R-SIG-Mac] stupid question on abline

I must be missing something very obvious

 data <-ts(rnorm(120,0,1),start=1900,frequency=12)
 plot(data)
 abline(a=0,b=1)

# draws nothing
abline(a=0,b=0)  #works
abline(a=1,b=0)  #works
abline(a=0,b=.5) # doesnt work

abline will only draw if b=0
> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] zyp_0.9-1         Kendall_2.1       rgdal_0.6-26      zoo_1.6-4
ncdf_1.6          R.utils_1.5.0     uncompress_1.34   R.oo_1.7.3
 [9] R.methodsS3_1.2.0 maps_2.1-4        raster_1.5-4      sp_0.9-66

loaded via a namespace (and not attached):
[1] grid_2.11.1    lattice_0.18-8 tools_2.11.1
> abline(a=0,b=0)

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list