[R] how to specify the order of panels with xyplot
Dan Kortschak
dan.kortschak at adelaide.edu.au
Fri Nov 20 02:46:17 CET 2009
> chromosomes
id refseq name length
1 0 NC_000001.9 Homo sapiens chromosome 1 247249719
2 1 NC_000002.10 Homo sapiens chromosome 2 242951149
3 2 NC_000003.10 Homo sapiens chromosome 3 199501827
4 3 NC_000004.10 Homo sapiens chromosome 4 191273063
5 4 NC_000005.8 Homo sapiens chromosome 5 180857866
6 5 NC_000006.10 Homo sapiens chromosome 6 170899992
7 6 NC_000007.12 Homo sapiens chromosome 7 158821424
8 7 NC_000008.9 Homo sapiens chromosome 8 146274826
9 8 NC_000009.10 Homo sapiens chromosome 9 140273252
10 9 NC_000010.9 Homo sapiens chromosome 10 135374737
11 10 NC_000011.8 Homo sapiens chromosome 11 134452384
12 11 NC_000012.10 Homo sapiens chromosome 12 132349534
13 12 NC_000013.9 Homo sapiens chromosome 13 114142980
14 13 NC_000014.7 Homo sapiens chromosome 14 106368585
15 14 NC_000015.8 Homo sapiens chromosome 15 100338915
16 15 NC_000016.8 Homo sapiens chromosome 16 88827254
17 16 NC_000017.9 Homo sapiens chromosome 17 78774742
18 17 NC_000018.8 Homo sapiens chromosome 18 76117153
19 18 NC_000019.8 Homo sapiens chromosome 19 63811651
20 19 NC_000020.9 Homo sapiens chromosome 20 62435964
21 20 NC_000021.7 Homo sapiens chromosome 21 46944323
22 21 NC_000022.9 Homo sapiens chromosome 22 49691432
23 22 NC_001807.4 Homo sapiens mitochondrion 16571
24 23 NC_000023.9 Homo sapiens chromosome X 154913754
25 24 NC_000024.8 Homo sapiens chromosome Y 57772954
> xyplot(hits~bin|chromosomes$name[Chromosome+1],data=hits,horizontal=FALSE,origin=0,lab=c(3,10),pch=20,cex=0.01,layout=c(1,5,5),strip=strip.custom(style=3,bg="grey90",par.strip.text=list(cex=0.5)),as.table=TRUE)
I am wondering how to reorder the panels such that they are plotted in
the order of chromosomes$id rather than chromosomes$name. I am sure that
this has been answered in the past, but I am finding it difficult to
understand (I have looked at factor and reorder.factor).
(I've had a look at strip.custom to see if I can get what I want with
that, and it looks like I should be able to, but I can't figure out
how).
thanks
Dan
More information about the R-help
mailing list