Dear all, I am plotting data with lattice's stripplot. Is it possible to add a median line to each cluster? This is the working example:
``` Sample = c("A0", "A0", "A0", "A3", "A3", "A3", "A7", "A7", "A7", "A9", "A9", "A9", "H1", "H1", "H1", "H2", "H2", "H2", "H3", "H3", "H3", "P1", "P1", "P1", "P2", "P2", "P2", "P3", "P3", "P3", "P4", "P4", "P4", "P5", "P5", "P5", "P7", "P7", "P7", "A0", "A0", "A0", "A3", "A3", "A3", "A7", "A7", "A7", "A9", "A9", "A9", "H1", "H1", "H1", "H2", "H2", "H2", "H3", "H3", "H3", "P1", "P1", "P1", "P2", "P2", "P2", "P3", "P3", "P3", "P4", "P4", "P4", "P5", "P5", "P5", "P7", "P7", "P7") Group = rep(c("Normal", "Tumour", "Metastasis" ), 26) Taxon = c(rep("Microviridae", 39), rep("Caudovirales", 39)) Aboundance = c(0, 151, 3, 0, 102, 509, 4, 1, 277, 4, 87, 7, 16, 13, 22, 47, 12, 1, 5, 251, 4, 8, 4, 2, 14, 4, 2, 10, 4, 4, 13, 1, 1, 5, 7, 2, 6, 6, 4, 1, 2, 1, 2, 1, 2, 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) df = data.frame(Sample, Group, Taxon, Aboundance, stringsAsFactors = FALSE) library(lattice) stripplot( Aboundance ~ Taxon|Group, df, groups = Taxon, scales=list(y=list(log=T)), pch=16, cex = 1.5, ylab = expression(bold("Number of taxons")), jitter.data = TRUE, layout=c(3,1), col = "black", # colour panels differently par.settings=list(strip.background=list(col=c("darkorchid3", "darkolivegreen3", "brown3"))), strip = function(..., bg) { strip.default(..., bg = trellis.par.get("strip.background")$col[which.packet()]) }, # add median bar ) ``` Thank you -- Best regards, Luigi ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.