On Fri, Sep 16, 2011 at 2:17 AM, Cram Rigby <cram.rigby at gmail.com>
wrote:> I have a problem with lattice log scales that I could use some help with.
>
> I'm trying to print log y-axis scales without exponents in the labels.
> ?A similar thread with Deepayan' recommendation is here:
> http://tolstoy.newcastle.edu.au/R/e11/help/10/09/9865.html. ?For
> example, this code using xyplot produces a logged y-axis but the
> labels ?(e.g. "10^1.2") are not very user-friendly:
>
> xyplot(24:300~24:300, scales=list(y=list(log=T)))
>
> So, trying another y.scale.component function, we get something more
> agreeable for y-axis scale labels:
>
> xyplot(24:300~24:300, scales=list(y=list(log=T)), yscale.components >
yscale.components.log10.3)
>
>
> However, my problem is that occasionally I'll have to plot data that
> doesn't quite "work". ?For example, in the following example,
I only
> get one y-axis scale label:
>
> xyplot(11:30~11:30, scales=list(y=list(log=T)), yscale.components >
yscale.components.log10.3)
>
> or worse, no y-axis scale labels:
>
> xyplot(11:19~11:19, scales=list(log=T), yscale.components >
yscale.components.log10.3)
>
>
> What would be most helpful is if someone can show me how to use an
> xyplot y-scale function to mimic log y-scale labels generated with the
> standard plot command. ?This seems to work regardless of the
> underlying data range:
>
> plot(11:30,11:30,log = "y")
> plot(24:300,24:300,log="y")
That is because the standard graphics log-axis rules (which is
codified in axTicks(), and depends critically on par("yaxp")) is more
sophisticated than latticeExtra:::logTicks() (which was originally
written as a proof-of-concept demo).
To make logTicks() equally sophisticated, we need to replicate the
logic used to compute par("yaxp") (in src/main/graphics.c, I think),
which is doable, but not trivial.
-Deepayan