Hi, Try this: genotype1<-factor(genotype,levels=c("CJ1450 NW 4/25/12","CJ1450 BAL 4/25/12", "CJ1450 NW\n4/27/12", "CJ1450 BAL 4/27/12", "CJ1721 NW 4/27/12", "CJ1721 BAL\n4/27/12", "CJ1721 NW 4/29/12", "CJ1721 BAL 4/29/12") )
segplot(genotype1 ~ 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, ...)}) A.K. ----- Original Message ----- From: JDINIS <jorgemdi...@gmail.com> To: r-help@r-project.org Cc: Sent: Friday, November 2, 2012 11:04 PM Subject: [R] reorder() in the latticeExtra library 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, ...)}) -- View this message in context: http://r.789695.n4.nabble.com/reorder-in-the-latticeExtra-library-tp4648299.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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. ______________________________________________ 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.