首先,as.POSIXct 是可以的,只是对于 00:00:00 没显示这个时刻而已:
<br />
x = as.POSIXct(strptime("00:00:00", "%H:%M:%S"))<br />
print(x)<br />
# [1] "2012-11-21 CST"<br />
dput(x)<br />
# structure(1353427200, class = c("POSIXct", "POSIXt"), tzone = "")<br />
x = as.POSIXct(strptime("00:00:01", "%H:%M:%S"))<br />
print(x)<br />
# [1] "2012-11-21 00:00:01 CST"<br />
dput(x)<br />
# structure(1353427201, class = c("POSIXct", "POSIXt"), tzone = "")<br />
</p>
数据内部的时间戳还是有的。
由于用 UNIX 时间戳表示时间数据时本身就是带日期的 (1970-01-01 0 点后经过的秒数),而结合 scales 让这个轴不显示日期很简单,所以暗含个冗余的日期应该无所谓吧:
<br />
require(ggplot2)<br />
require(scales)</p>
<p>df = data.frame(<br />
time = as.POSIXct(seq(Sys.time(), len = 160, by = '10 min')),<br />
value = runif(160)<br />
)</p>
<p>dt = qplot(time, value, data = df, geom = 'line') + theme(aspect.ratio = 1/4)<br />
dt + scale_x_datetime(breaks = date_breaks("4 hour"),<br />
labels = date_format("%H:%M"))<br />
</p>

详情 http://docs.ggplot2.org/current/scale_datetime.html