Dear R-Helpers,
I am not very experienced in using lattice and I am still in the learning
stage
I have a data set which looks like this: (I have deleted a few lines in
order to save space)
Chromosome marker Marker.Name Distance
1 1 1 PeMm261 0.0000
2 1 2 Xtxp8 10.1013
..
20 1 20 EbMi148 210.3099
21 1 21 Xtxp25 232.0118
22 2 1 EcMm152 0.0000
23 2 2 EeMp342 5.1474
...
36 2 15 EaMp217 124.5115
37 2 16 EaMp131 136.9033
....
40 3 1 TEak2908 0.0000
41 3 2 Xtxp303 4.7094
42 3 3 EhMm195 10.1694
(I have 11 chromosome in total .. so conditioning on chromosome gives me 11
panels)
This is a data.frame which contains Chromosome Number, Marker Number for
that chromosome and the corresponding Marker.Name and Distance.
I want to plot the genetic distance conditioned on chromosome and the marker
name listed below the distance where the marker is situated on chromosome
(something like this picture)
Panel 1 : Chromosome 1
|-------------------|------------------------- (so and so forth)
PeMm261 Xtxp8
<---- 10.1013 -> (the distance b/w these markers is same as the
corresponding value in marker$Distance - see 1 and 2 row in the sample
output)
and similarly for other chromosomes.
I tried:
plt1 = dotplot( ~ Distance | Chromosome, data=marker,par.strip.text =
list(cex = 0.75), layout = c(1,11),
lattice.options=list(legend="right"), xlab="Distance in cM",
ylab="",
scales= list(cex=0.5),
panel = function(x, y) {
panel.grid(h=1,v= 345)
panel.xyplot(x, y,pch=20,type="o",lwd="2",cex=1.5)
},
)
update(plt1, main="Genetic Map",
strip = strip.custom(factor.levels = c("1",
"2","3","4","5","6","7","8","9","10","11"), strip.levels = TRUE))
This gives me the location of markers on the respective chromosomes
corresponding to the distances in the above data.frame. The markers are just
shown as points.
MY QUESTIONS - 1) If I want to label these dots with the corresponding
marker names - How do I do that?
2) Is there a way in lattice - to know which
panel I am in.
I tried inserting panel.text in the panel function - but it doesn't like
that. (I also played around with scales - but without any success)
Any help will be greatly appreciated.
Thx,
S.
-------------------------------------------------------------------------------
> sessionInfo()
R version 2.9.1 (2009-06-26)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lattice_0.17-25 qtl_1.14-2
loaded via a namespace (and not attached):
[1] grid_2.9.1 tools_2.9.1
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.