[R] log scale y axis ticks control?

Sebastian Weber Sebastian.Weber at physik.tu-darmstadt.de
Sun May 18 11:28:06 CEST 2003


Hello R Users!

I'm using lattice to produce some graphs with logaritmic y-scales. I use
the command

xyplot(hits ~ c(1:1024), data=eichData, type="S", scales=list(y =
list(log=10)))

to create the plot. This is fine, except for the automatically choosen
tick marks. I'd like to have a major tick at the 10^n location and minor
ticks in between which correspond with the native variable. To get this
working I have to use at and label like

labl <- rep("", 30)
labl[1] <- "1"; labl[10] <- "10"; labl[19] <- "100"; labl[28] <- "1000";
nums <- c(1:10, seq(20,100, 10), seq(200, 1000, 100))
xyplot(hits ~ c(1:1024), data=eichData, type="S", scales=list(y =
list(log=10, at=nums, labels=labl)))

But this definitely extremly clumsy. There has to be an easier way to do
it which I haven't found yet.

Another nifty feature would be mixing these two axis styles. One axis
with linear ticks (10^0, 10^0.5, 10^1, ...) and the other axis with tick
marks as indicated above.

Thanks in advance,

Sebastian Weber




More information about the R-help mailing list