views:

232

answers:

2

I've a problem concerning construction of log y-axis in a graphic. How can I manage that the units/numbers of my log y-axis aren't shown in 1e+03, 1e+04, 1e+05 etc...., but only in regluar arabic numbers (1000, 10000, 100000)? Thanks.

+5  A: 

You need to remove the axis (by setting yaxt = "n") and then re-format it properly:

plot((1:100)^3, log = "y", yaxt = "n")
axis(2, format(c(1,10,100)^3, scientific=FALSE))

This was asked before on R-help.

Shane
I suggest using axis(2, format(axTicks(2,log=TRUE), scientific=FALSE)) in the second line. Then it's less "human depend".
Marek
+2  A: 

Additionally, if you just don't like the look of 1e+03 scientific notation, the sfsmisc package has the axTxpr() function to format axis labels in a * 10^k notation.

library(sfsmisc)
example(axTxpr)
Kevin