[R] adding a curve with xaxs="i"

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Tue Jan 6 14:15:31 CET 2009


Valentina Kraus wrote:
> Unfortunately, I need add=T because there are many other things in the graph.
> 
> I could swear that it worked 2 years ago. 

It can't have worked. Axis settings are fixed before you start adding
things. Presumably you used xlim, xaxs et al. on one of the previous
commands.

> Maybe there's something wrong with an update.


> 
> -------- Original-Nachricht --------
> 
>> See if this gets you closer to what you want.
> 
>>   curve (hm,lty=1,xaxs="i",  xlim=c(0,1), yaxs="i", xlab="", xaxt="n" )
> 
>> Seemed as though the , add=TRUE, parameter was getting in the way of  
>> the other par settings working as "expected".
> 
> 
>> On Jan 5, 2009, at 6:23 PM, Valentina Kraus wrote:
>>
>>> I want the curve to touch the y axis like the curve touches the  
>>> upper boundary.
>>>
>>> How can I eliminate the margin between axis and curve on the left  
>>> side?
>>>
>>> x1 <- c(1,2,3,4,5)
>>> x2 <- c(2,4,6,8,10)
>>> mod <- lm (x2~x1)
>>> hm <- function (x) (mod$coe[1]+x*mod$coe[2])
>>> plot.new()
>>> # ...
>>> box()
>>> curve (hm,lty=1,add=T,xaxs="i",yaxs="i")
>>>
>>> (R 2.8.1)
>>> -- 
>>> Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL
>>> für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> 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 at r-project.org mailing list
> 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.


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907




More information about the R-help mailing list