[R] inter tick distance

Duncan Murdoch murdoch at stats.uwo.ca
Mon Sep 10 21:17:53 CEST 2001


On Mon, 10 Sep 2001 12:05:45 -0700, you wrote in message
<NCBBKMNKKMFCIGDCHLDOCEPGCKAA.niels.waller at home.com>:

>
>
>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)

I think if you use both 'par(pty="s")' and set both xlim and ylim to
the same size, then the ticks have the same spacing.  Doing it with
your example leaves ugly space above or below the plot (so titles will
appear misplaced); I don't know a simple way around that, but you can
manually move titles (using the line= parameter of mtext()).

 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)

 par(pty='s')

plot(c(-4,4),c(0,4),type="n",xlim=c(-3,3),ylim=c(-1,5),axes=FALSE,xlab="",ylab="",
     main="Too high",sub="Too low")
 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)

Duncan Murdoch

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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