Marc Paterno
2010-Nov-06 19:02 UTC
[R] Prettier axis labels when using log scales in Lattice
Hello, I am trying to alter the way in which lattice functions (specifically xyplot) print the axis labels when one uses the 'scales' parameter. I can obtain the effect I want by using scales=list(y=list(log=10, labels=expression(yvalues))) where yvalues are the values that would have been printed as the y-axis labels if the "labels" argument had not been present. To help clarify what I am looking for, compare the first of the following plots with the second: data(iris) xyplot(Sepal.Length~Sepal.Width, iris, scales=list(y=list(log=10))) xyplot(Sepal.Length~Sepal.Width, iris, scales=list(y=list(log=10, labels=expression(10^0.65,10^0.7,10^0.75,10^0.8,10^0.85,10^0.85,10^0.9)))) The second is the effect I am trying to achieve. Is there a way to do this without explicitly entering the expressions to be printed on the y-axis? thanks, Marc Paterno
Gabor Grothendieck
2010-Nov-06 19:20 UTC
[R] Prettier axis labels when using log scales in Lattice
On Sat, Nov 6, 2010 at 3:02 PM, Marc Paterno <paterno at fnal.gov> wrote:> Hello, > > I am trying to alter the way in which lattice functions (specifically xyplot) print the axis labels when one uses the 'scales' parameter. > I can obtain the effect I want by using > ?scales=list(y=list(log=10, labels=expression(yvalues))) > where yvalues are the values that would have been printed as the y-axis labels if the "labels" argument had not been present. To help clarify what I am looking for, compare the first of the following plots with the second: > > data(iris) > xyplot(Sepal.Length~Sepal.Width, iris, scales=list(y=list(log=10))) > > xyplot(Sepal.Length~Sepal.Width, iris, scales=list(y=list(log=10, labels=expression(10^0.65,10^0.7,10^0.75,10^0.8,10^0.85,10^0.85,10^0.9)))) > > The second is the effect I am trying to achieve. Is there a way to do this without explicitly entering the expressions to be printed on the y-axis? >Try: library(latticeExtra) xyplot(Sepal.Length~Sepal.Width, iris, scales=list(y=list(log=10)), yscale.components = yscale.components.logpower) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Possibly Parallel Threads
- How do I plot a line followed by two forecast points?
- Apparent bug in summaryBy (PR#13941)
- How to write a new "top-level" Trellis/lattice function?
- keep adding elements to the matrix
- Prettier axis labels when using log (or exp!!) scales in Lattice (follow up)