[R] Misunderstanding with lines (or elsewhere)

vincent at 7d4.com vincent at 7d4.com
Tue Jul 11 15:39:58 CEST 2006


Prof Brian Ripley a écrit :

> Think about the coordinate system you are using: if you don't set the 
> margins to zero you will see what it is.
> I suggest you supply x and y to image() to set the coordinate system to 
> what you want it to be.

Thank you for your answer.
If I have well understood, the right way to proceed
must be :

test = function()
{
m = matrix(0, 2, 2)
par(new=T, fig = c(0,1,0,1), mai=c(0,0,0,0), mar=c(0,0,0,0), bty='n')
x0 = c(0.25 , 0.75)
y0 = x0
image(x=x0, y=y0, z=m)
lines(c(0,1), c(1/4,1/4))         # horizontal line
}

which seems indeed to work.
Thanks.



More information about the R-help mailing list