I want to create a one dimensional scatterplot of points in time (range of about 5 hours), to visualise e.g. the time when I get up in the morning.
I tried
time=rep(Sys.time(),100)+round(3600*rnorm(100),1)
stripchart(as.numeric(time), main="stripchart", method="jitter", jitter = 2)
where I believe time is given in seconds since epoch. I'm interested in times of the day(8:02, 7:50,...) so time in seconds does not work for me. I need as.numeric
however as I get 'invalid first argument' for leaving it out.
答案 0 :(得分:2)
使用xaxt="n"
绘制没有x轴标签的图表,然后使用axis
将其添加数小时和分钟。我正在使用pretty
来获取小时的开头。
time=rep(Sys.time(),100)+round(3600*rnorm(100),1)
stripchart(as.numeric(time), main="stripchart", method="jitter", jitter = 2, xaxt="n")
axis(side=1,pretty(time), format(pretty(time),"%H:%M"))
答案 1 :(得分:1)