[R] log scale y axis ticks control?
Deepayan Sarkar
deepayan at stat.wisc.edu
Sun May 18 23:49:25 CEST 2003
On Sunday 18 May 2003 04:28, Sebastian Weber wrote:
> 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.
No, there's no easier way (mainly because I couldn't think of an easy way to
code this). If you can suggest a general algorithm I would be happy to
incorporate it.
> 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.
You mean different ticks/labels on the left and right sides of the panel ? I'm
afraid that would be difficult to implement under the current setup. One
alternative would be to do this inside the panel, in which case you could
code it as part of the panel function.
Deepayan
More information about the R-help
mailing list