Afshartous, David
2009-May-16 21:11 UTC
[R] Lattice scales question: using "at" when log = TRUE
All, I have a simple lattice plot where I have set log = TRUE for the y scale. When I attempt to change the tick locations via the "at" argument within scales, the supplied numeric vector is not followed. Any suggestions much appreciated for the example below: y = c(10^1.5, 10^2, 10^3, 10^2) t = c(1,2,3,4) xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE))) ## tick marks not followed for supplied marks below: xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE), at = c(10^1, 10^2, 10^2.5, 10^3))) Cheers, David PS - Another thing is that the scale is no longer in scientific notations, but that is okay since this can be fixed via the labels argument within scales: e.g., labels = c(expression(10^1), expression(10^2), ...) An example of fancy labels for log axes is on p.147 of Deepayan's Lattice book.
Gabor Grothendieck
2009-May-16 22:11 UTC
[R] Lattice scales question: using "at" when log = TRUE
Your parentheses are wrong. It should be y = list(log = TRUE, at = ...) On Sat, May 16, 2009 at 5:11 PM, Afshartous, David <DAfshartous at med.miami.edu> wrote:> > All, > > I have a simple lattice plot where I have set log = TRUE for the y scale. > > When I attempt to change the tick locations via the "at" argument within > scales, the supplied numeric vector is not followed. Any suggestions much > appreciated for the example below: > > y = c(10^1.5, 10^2, 10^3, 10^2) > t = c(1,2,3,4) > xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE))) > > ## tick marks not followed for supplied marks below: > xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE), at = c(10^1, > 10^2, 10^2.5, 10^3))) > > Cheers, > David > > PS - > Another thing is that the scale is no longer in scientific notations, but > that is okay since this can be fixed via the labels argument within scales: > e.g., labels = c(expression(10^1), expression(10^2), ...) > An example of fancy labels for log axes is on p.147 of Deepayan's Lattice > book. > > ______________________________________________ > R-help at r-project.org 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. >