andrejfavia at ml1.net
2015-May-31 23:49 UTC
[R] How do I move the horizontal axis in a plot so that it starts at the zero of the vertical axis?
Alright but then if I include an aspect ratio, the y-axis no longer starts at 0 at the bottom of the plot. 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)
Boris Steipe
2015-Jun-01 03:32 UTC
[R] How do I move the horizontal axis in a plot so that it starts at the zero of the vertical axis?
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)