I am afraid I have lost the plot, literally! Why does the axis command not put an x axis in the following plot? It must be something ridiculous, as I can't simplify much more.
yar <- c(.2,.1,.05,.03,.02)
plot(yar,xaxt='n')
axis(1, at=c(0.01,0.02,0.03,0.04,0.05))
The reason your x axis is not appearing is that your placed it in a region of the plot where it is so small that it is not visible as output. You issued the following plot command:
plot(yar, xaxt='n')
which is really the same as doing
plot(c(1:5), yar, xaxt='n')
Since you never specified any x values, the default x value are just the counting numbers 1 through 5 corresponding to y values you did specify.
The solution to the problem is to place the x-axis where it will be visible. Hence you can try the following code:
xar <- 0.01*c(1:5)
yar <- c(.2,.1,.05,.03,.02)
plot(xar, yar, xaxt='n')
axis(1, at=xar)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With