[R] controling x-labels in xyplot (lattice) when x is POSIX object

john.gavin@ubs.com john.gavin at ubs.com
Mon Oct 20 19:35:43 CEST 2003


Hi,

V1.8.0 seems to allow DateTimeClasses as the x argument in xyplots (lattice).
For example:

x <- seq.POSIXt(strptime("2003/01/01", format = "%Y/%m/%d"),
                strptime("2003/10/01", format = "%Y/%m/%d"), by = "month")
y <- rnorm(length(x))
dat <- data.frame(x= x, y = y)
xyplot(y ~ x, data = dat, type = "b")

However, the labelling for the x-axis is not what I want.
(I see only one tick mark and one label ('Oct').)
What is the recommended way to relabel the x-axis?
Ideally, I want to see several months (3-6) labelled along the x-axis.

Previously, I used 'calculateAxisComponents' to massage the labels manually
but that function (which I realise was internal to lattice) is no longer available.

I am on Windows XP, R 1.8.0.

Regards,

John.

John Gavin <john.gavin at ubs.com>,
Quantitative Risk Models and Statistics,
UBS Investment Bank, 6th floor, 
100 Liverpool St., London EC2M 2RH, UK.
Phone +44 (0) 207 567 4289
Fax   +44 (0) 207 568 5352

Visit our website at http://www.ubs.com

This message contains confidential information and is intend...{{dropped}}




More information about the R-help mailing list