My situation is quiet like this question, how ever i need to plot multiple time series(or fixed length vectors) in one panel. (I want to upload a picture but it says i dont have enough reputation ...)
here's my sample code.
Column "id" identify a user. (sample code only has 1 user)
Column "time" scale from 1 to 24*7 hours (hourly summary of 1 week)
Column "A","B","C" are attributes summary hourly
> require(data.table)
# Create some data
> dt<-data.table(id=rep(123,168),time=1:168,A=rnorm(168,10,5),B=rnorm(168,100,20),C=rnorm(168,10,5))
> dt
id time A B C
1: 123 1 2.435577 147.01446 12.484723
2: 123 2 15.119403 88.05115 7.226495
3: 123 3 17.835930 110.01482 6.888222
4: 123 4 10.455834 102.48860 13.098892
5: 123 5 8.107672 83.70896 7.711350
---
164: 123 164 8.301877 145.88020 10.195002
165: 123 165 12.403081 97.90534 14.249087
166: 123 166 16.563673 125.69398 11.039720
167: 123 167 11.091746 98.81823 15.131038
168: 123 168 10.190338 87.32466 11.422943
> z<-zoo(dt)
> plot(z[,3:5],yax.flip=TRUE,col=1:3) #plot all attributes timeseries in one panel
I would like to add grid and customize x-axis to be something like this:
Mon.,1,2,3,...,23,Tue.,1,2,3,...,23,Wed.,1,2,3,...,23,Thu.,1,2,3,...,23,Fri.,1,2,3,...,23,Sat.1,2,3,...,23,Sun.,1,2,3,...,23
I tried to use axis
, abline
and grid
to get what i want but it simply won't work.(it works fine if plot.type=single
)