[R] How do I move the horizontal axis in a plot so that it starts at the zero of the vertical axis?

Boris Steipe boris.steipe at utoronto.ca
Mon Jun 1 05:32:26 CEST 2015


Like this?

x <- c(-2.5, -1.3, 0.6, 0.8, 2.1)
y <- c(0.3, 1.9, 1.4, 0.7, 1.1)

plot(x, y, ylim=c(0, 2), axes=FALSE, asp=1.25)
box()
abline(h=0)
axis(side=1, pos=0.0, lwd=0, lwd.ticks=1)
axis(side=2, lwd=0, lwd.ticks=1)

B.

On May 31, 2015, at 7:49 PM, andrejfavia at ml1.net wrote:

> x <- c(-2.5, -1.3, 0.6, 0.8, 2.1)
> y <- c(0.3, 1.9, 1.4, 0.7, 1.1)
> 
> plot(x, y, ylim=c(0, 2), yaxs="i", asp=1.25)



More information about the R-help mailing list