[R] lattice xyplot - aligning date labels so that they align with the grid lines in panel.grid

From: <john.gavin_at_ubs.com>
Date: Tue 20 Jun 2006 - 03:50:14 EST


Hi,

I have a basic question about aligning date labels for the x-axis in an xyplot so that they align with the grid lines from the panel.grid argument.

For example, with

x <- data.frame(
  date = seq(as.Date("2005/01/01"), as.Date("2006/06/01"),   length.out = 20), value = runif(20))
xyplot(value ~ date, data = x,
  panel = function(x, y, subscripts, ...)   { panel.grid(h = -1, v = -1, col = "grey", lwd = 1, lty = 1)     panel.xyplot(x, y, ...)
  })

How can I get the labels on the x-axis to align with the vertical grid lines?
i.e. I have 6 vertical grid lines by default (v = -1) in this example so I would like 6 labels along the x-axis at the same points, whereas I see only 2 (2005 and 2006).

As an alternative I would be happy to just specify the number of labels as long as panel.grid's vertical lines aligned with the labels.

> R.version.string

[1] "Version 2.3.1 (2006-06-01)"

on Windows NT4.

Regards,

John.

John Gavin <john.gavin@ubs.com>,
Commodities, FIRC,
UBS Investment Bank, 2nd floor,
100 Liverpool St., London EC2M 2RH, UK.
Phone +44 (0) 207 567 4289
This communication is issued by UBS AG or an affiliate ("UBS...{{dropped}}



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jun 20 03:57:57 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 20 Jun 2006 - 06:12:16 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.