使用以下数据:
$cat spike.csv
time,ts,count
2013-04-30 23:58:55,1367366335,32
2013-04-30 23:58:57,1367366337,664
2013-04-30 23:59:03,1367366343,4892
2013-04-30 23:59:04,1367366344,5185
2013-04-30 23:59:09,1367366349,4548
2013-04-30 23:59:10,1367366350,4154
2013-04-30 23:59:22,1367366362,1750
2013-04-30 23:59:23,1367366363,1720
2013-04-30 23:59:24,1367366364,1624
2013-04-30 23:59:32,1367366372,1152
2013-04-30 23:59:33,1367366373,1217
2013-04-30 23:59:59,1367366399,704
2013-05-01 00:00:00,1367366400,642
2013-05-01 00:00:01,1367366401,688
2013-05-01 00:00:02,1367366402,682
2013-05-01 00:00:03,1367366403,660
2013-05-01 00:00:09,1367366409,594
2013-05-01 00:00:10,1367366410,554
2013-05-01 00:02:09,1367366529,259
2013-05-01 00:02:10,1367366530,281
2013-05-01 00:02:11,1367366531,242
2013-05-01 00:02:12,1367366532,280
2013-05-01 00:02:25,1367366545,252
2013-05-01 00:02:26,1367366546,273
使用 R,我为时间列创建 POSIXct 对象。
>spike<-read.delim("NEED/stack.csv",sep=",")
>spike$time<-as.POSIXct(spike$time, format='%Y-%m-%d %H:%M:%S')
然后我使用ggplot绘制数据:
>ggplot(spike,aes(x=time,y=count))+
geom_point(size=3)+
geom_point(size=2,color="cyan")+
geom_line()+
theme(axis.text.x = element_text(siz=10))+
xlab("Time (mins)")
我希望 x 轴以一分钟的间隔专门休息,对于小于 00:00 的值,我希望以分钟为单位查看负值。建议休息时间:-00:02、-00:01、00:00、00:01、00:002。任何建议将不胜感激。想法?