Re: [R] panel order in xyplot

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Fri 23 Dec 2005 - 01:36:17 EST

On 12/22/05, Antje Döring <Antje.Doering@komdat.com> wrote:
> Hi all,
>
>
>
> I have a question concerning xyplot. My data is a data.frame looking like
> that:
>
>
>
> In the first column I have numbers from 0 to 23 (hours of a day), the second
> column contains the name of a weekday (Day as factor) and the third column
> contains the number I am interested in. So as an example, the first five
> rows look like that:
>
>
>
> Hour Day Freq
>
> 1 0 Mo 23
>
> 2 1 Mo 20
>
> 3 2 Mo 14
>
> 4 3 Mo 27
>
> 5 4 Mo 26
>
>
>
> To read: On Monday between 0 and 1 o'clock 23 things happened.
>
>
>
> The code of the xyplot looks like that:
>
>
>
> trellis.device(new = FALSE, col = FALSE)
>
> xyplot(Freq ~ Hour | Day, data = mydata,
>
> xlab = "hour", ylab = "number", main = "xxx", ylim = 1:30,
>
> scales = list(x = list(at = seq(0,24,6), labels = c(0, 6, 12, 18,
> 24), cex = 0.7, relation = "free"),
>
> y = list(tick.number = 5, cex = 0.7)), between = list(x = 0.5, y =
> 1.5),
>
> layout = c(4,2), aspect = 1,
>
> panel = function(x,y){
>
> panel.grid()
>
> panel.barchart(x, y, horiz = F, aspect = 1, col = "red")
>
> }
>
> )
>
>
>
> Now my problem:
>
> The plot is ordered by default, that in the first row I can see Friday,
> Saturday and Sunday, in the second row there is Monday, Tuesday, Wednesday
> and Thursday. I like to order the panels that way that in the first row
> there should be Monday-Thursday, the last row to contain Friday - Sunday.
>
> Is there any parameter in xyplot I can add to achieve this result?

'as.table'.

> Any parameter where I can tell how the panels have to be arranged?

Deepayan
--
http://www.stat.wisc.edu/~deepayan/



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Dec 23 01:43:02 2005

This archive was generated by hypermail 2.1.8 : Fri 23 Dec 2005 - 04:28:02 EST