[R] Lattice xyplot log scale labels help!

Cram Rigby cram.rigby at gmail.com
Thu Sep 15 22:47:02 CEST 2011


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")


Thanks for any input!



More information about the R-help mailing list