On Nov 2, 2012, at 8:04 PM, JDINIS wrote:

> Hello all, thanks for your time and help. Below are my commands, and it
> generates a really nice plot, however I am not happy with the reorder()
> function. I would like the order to be the same as they appear in the
> genotype variable  "genotype <- c("CJ1450 NW 4/25/12","CJ1450 BAL
> 4/25/12","CJ1450 NW 4/27/12","CJ1450 BAL 4/27/12","CJ1721 NW
> 4/27/12","CJ1721 BAL 4/27/12","CJ1721 NW 4/29/12","CJ1721 BAL 4/29/12" )"
> and not as it is currently coded.
> 
> Is there any way to turn off the reorder, or set it up so the values appear
> in the order above, thank you again!
> 
> (I am open to all suggestions)
> 
> JD
> 
> 
> genotype <- c("CJ1450 NW 4/25/12","CJ1450 BAL 4/25/12","CJ1450 NW
> 4/27/12","CJ1450 BAL 4/27/12","CJ1721 NW 4/27/12","CJ1721 BAL
> 4/27/12","CJ1721 NW 4/29/12","CJ1721 BAL 4/29/12" )
> #paste("Animal", as.roman(1:8), sep = "-") 
> plant.height <- c(0.001173003, 0.001506127, 0.001361596, 0.001922572,
> 0.034272147, 0.030466017, 0.001654299, 0.001071724)
> SE <- c(0.000444123, 0.000290096, 0.000372844, 0.00197687, 0.033945128,
> 0.035231568, 0.001094518, 0.000423545) 
> lower <- plant.height - SE; upper <- plant.height + SE 
> x <- data.frame(group = genotype, lower = lower, est = plant.height, upper =
> upper)
> 
> library(latticeExtra) 
> segplot(reorder(genotype, est) ~ lower + upper, data = x, draw.bands =
> FALSE, centers = est, segments.fun = panel.arrows, ends = "both", angle =
> 90, length = 0, par.settings = simpleTheme(pch = 19, col = 1), xlab =
> expression("nucleotide diversity " %+-% " sd"), panel = function(x, y, z,
> ...) { 
> panel.abline(h = z, col = "grey", lty = "dashed") 
> panel.abline(v = 14.20, col = "grey") 
> panel.segplot(x, y, z, ...)}) 

Wouldn't you just define genotype as a factor with the desired sequence of 
levels and remove the call to reorder?

-- 
David Winsemius, MD
Alameda, CA, USA

______________________________________________
R-help@r-project.org 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.

Reply via email to