Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to customize axis when plot multiple time series data in 1 panel?
    primarykey
    data
    text
    <p>My situation is quiet like <a href="https://stackoverflow.com/questions/8919513/r-how-to-create-custom-x-axis-with-dates">this</a> 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 ...)</p> <p>here's my sample code.</p> <p>Column "id" identify a user. (sample code only has 1 user)<br> Column "time" scale from 1 to 24*7 hours (hourly summary of 1 week)<br> Column "A","B","C" are attributes summary hourly</p> <pre><code>&gt; require(data.table) # Create some data &gt; dt&lt;-data.table(id=rep(123,168),time=1:168,A=rnorm(168,10,5),B=rnorm(168,100,20),C=rnorm(168,10,5)) &gt; 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 &gt; z&lt;-zoo(dt) &gt; plot(z[,3:5],yax.flip=TRUE,col=1:3) #plot all attributes timeseries in one panel </code></pre> <p>I would like to add grid and customize x-axis to be something like this:</p> <p>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</p> <p>I tried to use <code>axis</code>, <code>abline</code> and <code>grid</code> to get what i want but it simply won't work.(it works fine if <code>plot.type=single</code>)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload