[R] Snap axes to origin rather than around it

Paul Chatfield p.s.chatfield at rdg.ac.uk
Fri Jun 12 14:18:44 CEST 2009


I'm trying to plot a graph where the axes go through 0,0, rather than around
it combined with a box round the graph, so

x<-0:10;y<-0:10
plot(x,y) 

gives me a box but doesn't go through the point 0,0, but stays at a
distance.

In trying to circumvent this problem, I wrote 

plot(x,y)
axis(1, pos=c(0,0));axis(2,pos=c(0,0)) 

which gives me axes that go through the origin, but then I can't make a box
round a plot (box() goes again at this fixed distance from the origin rather
than through it)

Any thoughts, ideas gratefully accepted.  Perhaps I've been looking at it so
long I'm now missing the obvious! :)

Paul

Any ideas?
-- 
View this message in context: http://www.nabble.com/Snap-axes-to-origin-rather-than-around-it-tp23997802p23997802.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list