[R] xyplot axis scaling with dates/times
David Carslaw
d.c.carslaw at its.leeds.ac.uk
Thu Jul 23 10:50:33 CEST 2009
Dear R users,
I'm trying to get a good x-scale and labels on a plot like the one below.
library(lattice)
## make almost a year of hourly data:
mydat <- data.frame(dates = Sys.time() + 3600 * (1:7000), y = runif(7000))
## plot it
xyplot(y ~ dates, data = mydat, type = "l")
Only one x-label is given (May). I would prefer several because it makes
the plot very difficult to interpret.
I then thought I could provide additional tick marks:
xyplot(y ~ dates, data = mydat, type = "l", scales = list(x =
list(tick.number = 10)))
But this has no effect. While I can set ticks at specific points (and
labels) this is difficult because a wide range of time intervals are used.
Any suggestions?
Thanks.
David
-----
Institute for Transport Studies
University of Leeds
Leeds
LS2 9JT
Tel: 0113 343 7522
d.c.carslaw at its.leeds.ac.uk
--
View this message in context: http://www.nabble.com/xyplot-axis-scaling-with-dates-times-tp24620903p24620903.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list