[R] How to control the number format on plot axes ?
pomchip at free.fr
Mon Aug 13 01:27:17 CEST 2007
Basically, everything is in the title of my e-mail. I know that some
threads from the archives have already addressed this question but they
did not really give a clear solution.
Here is a series of short codes that will illustrate the problem:
In the first and second examples, the plots are identical and the tick
labels are 1, 2, 5 and 10. In the third, the labels are number in the
x.0 format (1.0, 2.0, 5.0 and 10.0), even if there is no point below 1.
The only reason I see is because the first element of myTicks is 0.1.
And, the forth example is self-explanatory.
Interestingly, the 'scales' argument of xyplot in the lattice package do
not add these (unnecessary) decimals on labels greater than 1.
Do you know how I could transpose the behavior of the lattice 'scales'
argument to the 'axis' function ?
PS: No offense, but please don't suggest I use lattice. I have to go for
base R graphics in my full-scale project (it is a speed issue).
More information about the R-help