[R] inter tick distance

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Sep 10 21:09:53 CEST 2001


"niels Waller" <niels.waller at home.com> writes:

> R colleagues,
> 
> I am stumped. I would like the inter-tick distances to be the same on the x
> and y axes but cannot determine how to do so when the lower half of the y
> axis is not printed.  Thanks for any and all suggestions. (btw, setting
> par(pty="s")  does not solve my problem)
> 
> Niels Waller

This is a tough one. I think I would

a) set xaxs and yaxs to "i"
b) set xlim and ylim 
c) set pin to be proportional to the chosen limits.


Try replacing the last bit of your example with

par(pin=c(6,6))
plot(c(-4,4),c(0,4),type="n",xaxs="i",yaxs="i",
xlim=c(-3,3),ylim=c(-1,5),axes=FALSE,xlab="",ylab="")
axis(side=1,pos=0,labels=FALSE)
axis(side=2,pos=0,labels=FALSE,at=c(0,1,2,3,4))
arrows(0,0,M[1,1],M[1,2],angle=20,length=.15,lwd=2)
arrows(0,0,M[2,1],M[2,2],angle=20,length=.15,lwd=2)


> M<-matrix(c(2,1,
>            -1,3),2,2,byrow=TRUE)
> 
> dimnames(M)<-list(c("P1","P2"),c("V1","V2"))
> 
> writeLines(text=c("\n","Matrix M"))
> print(M)
> 
> plot(c(-4,4),c(0,4),type="n",xlim=c(-3,3),axes=FALSE,xlab="",ylab="")
> axis(side=1,pos=0,labels=FALSE)
> axis(side=2,pos=0,labels=FALSE,at=c(0,1,2,3,4))
> arrows(0,0,M[1,1],M[1,2],angle=20,length=.15,lwd=2)
> arrows(0,0,M[2,1],M[2,2],angle=20,length=.15,lwd=2)


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list