I have a level plot with a POSIXct axis, and I'd like to adjust how the date is displayed, as well as the number of ticks. My example plot looks like this:
library(lattice)
Beg<-as.POSIXct('2015-01-01 14:00:00',tz='UTC')
End<-as.POSIXct('2015-01-10 14:00:00',tz='UTC')
x<-seq(Beg,End,by='hour')
y<-rep(1:5,10)
z<-rep(1:5,10)
levelplot(z ~ x * y)
I'd like to display the dates in a "%d-%H" format, and increase the number of ticks so we have two ticks per day (at 11 and 23 hours)
I've tried using the scales argument as listed in other examples, but am having issues with POSIXct
ByHour<-x[as.numeric(format(x,"%H")) == 11 |as.numeric(format(x,"%H")) == 23]
d<-strftime(ByHour, format="%d-%H")
levelplot(z ~ x * y, scales= list(list(x=ByHour))) #Does not work
levelplot(z ~ x * y, scales= list(list(x=d))) #Does not work