我一直试图在莱迪思的xyplot.ts函数中设置带状文本。我正在为交通速度的时间序列绘制剖面图和堆栈图。带状文本默认为“时间”,但我想将其分配给与该面板对应的星期几(即星期五,星期六,星期日等)。也许有另一种处理方式会更有效。我喜欢xyplot提供的剪切和堆栈格式,但是我会乐于远离它(但要保持格状)。
dateSeq <- seq.POSIXt(from = as.POSIXct('2018-06-01 00:00:00', tz='UTC', origin='1970-01-01 00:00:00'),
to = as.POSIXct('2018-06-06 23:58:00', tz='UTC', origin='1970-01-01 00:00:00'),
by = '2 min')
speeds <- rnorm(length(dateSeq),mean = 65) %>% floor()
traffic.test <- xts::as.xts(speeds, order.by=dateSeq)
# setting cut's number to 6 will give a single plot for each day.
xyplot.ts(traffic.test, type='l',
superpose=T,
cut = list(number = 6, overlap = 0),
layout=c(1,8,1))
我试图在xts对象中设置第二列来创建一个因子变量,但运气不好。我也曾尝试使用xyplot中的strip.custom函数来完成此操作,但也没有那么多运气。
非常感谢您的帮助。