lattice: How to get log base for each axis inside panel function?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

lattice: How to get log base for each axis inside panel function?

Mikhail Titov-2
Hello!

I'd like to have a function to draw correct grid while using log axis with xyplot from lattice package. Right now I have the following code inside of my panel function:

lim <- current.panel.limits()
v <- latticeExtra:::logTicks(2^lim$xlim, loc=1)
h <- latticeExtra:::logTicks(2^lim$ylim, loc=1)
panel.abline(h=log2(h), v=log2(v), col="LightGray")

Is there an easy way to get log base used for particular axis to transform data so I can write general purpose panel.grid.log?

Mikhail

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: lattice: How to get log base for each axis inside panel function?

Deepayan Sarkar
On Mon, Aug 15, 2011 at 10:34 PM, Mikhail Titov <[hidden email]> wrote:

> Hello!
>
> I'd like to have a function to draw correct grid while using log axis with xyplot from lattice package. Right now I have the following code inside of my panel function:
>
> lim <- current.panel.limits()
> v <- latticeExtra:::logTicks(2^lim$xlim, loc=1)
> h <- latticeExtra:::logTicks(2^lim$ylim, loc=1)
> panel.abline(h=log2(h), v=log2(v), col="LightGray")
>
> Is there an easy way to get log base used for particular axis to transform data so I can write general purpose panel.grid.log?

No. The panel function gets no information regarding transformations
done to the data before being passed to it.

-Deepayan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.