[R] axis lines crossing at origin
Liaw, Andy
andy_liaw at merck.com
Thu Nov 11 17:27:10 CET 2004
You probably want something like:
plot(x,sin(x), xaxt="n", yaxt="n")
axis(1, pos=0)
axis(2, pos=0)
... but note that axis() only draws the axes from the minimum tick to the
maximum tick. You may still want to add:
abline(v=0, h=0)
HTH,
Andy
> From: Robin Hankin
>
> Hi
>
> how do I make my axes cross at the origin?
>
> x <- seq(from=-pi,to=pi,len=30)
> plot(x,sin(x))
>
> makes the axes cross at about (-pi,-1).
>
> How do I get my x and y axes to cross in the centre of the graph,
> with the sine curve passing through
> the intersection?
>
> I couldn't find anything in ?par or ?axis; searching R-FAQ for "axis"
> didn't help.
>
>
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> Southampton Oceanography Centre
> SO14 3ZH
> tel +44(0)23-8059-7743
> initialDOTsurname at soc.soton.ac.uk (edit in obvious way; spam
> precaution)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
More information about the R-help
mailing list