Hi Luigi, To display a nested breakdown like this I would suggest barNest. This is one way to display the nesting. Note that if you change the order of the factors in the formula you will get a different plot, so think about how you want the summaries nested. Error bars can only be displayed on the final breakdown.
# because you have fairly long labels, use a wide plot x11(width=10) barcol<-list("lightgray",c("#ff00ff","#ff99ff"), c("#00ff00","#66ff66"),c("#aaaa00","#888800")) barNest(y~x+z+w,Q,main="Double Measurement", ylab="Response",col=barcol,errbars=TRUE) Jim On Wed, Sep 23, 2020 at 10:48 PM Luigi Marongiu <marongiu.lu...@gmail.com> wrote: > > Hello, > I have an experiment measuring optical density (OD) when comparing > three parameters: > a) concentration of the target > b) concentration of the probe > c) concentration of the reporter antibody. > Using plotrix I can nicely draw the first two into clusters, but I > can't get separation for the third parameter. is there a way in > plotrix to custer data according to two, let's say, z parameters (I > call the second high-level parameter as w)? For instance, two > clusters, each separated into two subclusters. Or is this more a job > for lattice? > Thank you. > > ``` > x = rep(c(rep("1000 pmol", 4), rep("0 pmol", 4)),2) > z = rep(c(rep("Treated", 2), rep("Untreated", 2), rep("Treated", 2), > rep("Untreated", 2))) > w = c(rep("1:1000", 8), rep("1:2000", 8)) > y = c(1.18, 1.22, 1.52, 2.37, 0.97, 1.08, 1.17, 1.58, 1.16, 1.16, 2.27, 2.24, > 1.26, 1.28, 1.39, 1.77) > Q = data.frame(x, z, w, y, stringsAsFactors = FALSE) > names(Q) = c("[Target]", "Enzyme", "[Antibody]", "OD") > names(Q) = c("x", "z", "w", "y") # for ease, I'll use single letters > library(plotrix) > brkdn.plot(y~x+z, data=Q, > pch = c(1, 16), cex = 1.5, type="p", > main="Single Measurement", > xlab=expression(bold("S1 nuclease")), > ylab=expression(bold("Optical density"))) > brkdn.plot(y~x+z+w, data=Q, > pch = c(1, 16), cex = 1.5, type="p", > main="Double Measurement", > xlab=expression(bold("S1 nuclease")), > ylab=expression(bold("Optical density"))) > ``` > > ______________________________________________ > 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. ______________________________________________ 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.