I have a problem in plotting uneven scale plot on x axis with R
Here is an example:
plot(1:100,1:100)
will give the equal tick spac
For a logarithmic axis, use:
plot(x,y,log="x") ## specifies which axis to put on log scale
For determining how many "tick marks" to use, check
par()$lab
Default is 5,5,7
. To put more x axis labels, do
par(lab=c(10,5,7))
And for y:
par(lab=c(5,10,7))
This is not an easy one-off task to complete. You'll actually need to transform to the scaled data and supply custom tick marked axes. Any reason you haven't considered simply logging the x-axis instead? (supplying the option plot(x, y, log='x')
will do that).
What I think you've described is this:
xnew <- ifelse(x<10, x, x/10)
plot(xnew, y, axes=FALSE, xlab='x')
axis(1, at=c(0, 10, 20), labels=c(0, 10, 100))
axis(2)
box()
You could log
the x axis:
x<-1:100
y<-1:100
plot(log(x,base=10),y,axes=F)
axis(2)
axis(1,at=0:2,labels=10^(0:2))