[R] axis values on lattice log-scale plot

Deepayan Sarkar deepayan.sarkar at gmail.com
Wed Apr 8 18:27:52 CEST 2009


On 4/7/09, Don McKenzie <dmck at u.washington.edu> wrote:
> I'm plotting the following (stripped of inessentials)
>
>  xyplot(sd ~ distance |
> wshed,data=sdvar.df,scales=list(x=list(log=TRUE),y=list(log=TRUE)))
>
>  sdvar.df  is a data frame, sd and distance are numeric, wshed is an ordered
> factor
>
>  trying to replicate the action of  log="xy" in plot()
>
>  The plot works fine but the axis values at the ticks are in scientific
> notation,
>  e.g. 10^1.5, 10^2.0, ... on the X axis and 10^-.5, 10^-.4, ... on the Y
> axis.
>
>  I've searched the lattice help (and I know it must be in there    :-()  and
> the archive but can't seem to find a way to make
>  the axis values display as simply numeric  (i.e., 10,100,1000, ... on the X
> axis and proportions on the Y axis).
>
>  Suggestions much appreciated.

You need to provide your own axis annotation function.
?xscale.components.default gives you details and an example. Also, see
Figure 8.4 and 8.5 in

http://lmdvr.r-forge.r-project.org/

-Deepayan




More information about the R-help mailing list