Stéphane CRUVEILLER <scruveil <at> genoscope.cns.fr> writes: > I would like to know whether it is possible to draw several > stacked barplots (i.e. side by side on the same sheet)... > > my data look like : > > Cond1 Cond1' Cond2 Cond2' > Compartment 1 11,81 2,05 12,49 0,70 > Compartment 2 10,51 1,98 13,56 0,85 > Compartment 3 1,95 0,63 2,81 0,22 > Compartment 4 2,08 0,17 3,13 0,06 > Compartment 5 2,51 0,20 4,58 0,03 > > ps: Cond1' values should be stacked on Cond1, Cond2' on Cond 2 and so > on... and series 1 and 2 > should be side by side for each compartement....
Check the following example on xyplot/lattice: barchart(yield ~ variety | site, data = barley, groups = year, layout = c(1,6), stack = TRUE, auto.key = list(points = FALSE, rectangles = TRUE, space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) You have to reformat your data to the long format first for this, e.g. by using reshape. Comp Cond x 1 1 11.81 1 2 2.05 With allow.multiple=TRUE, it might be possible to avoid the reformatting, but I never have used that form, because I the "long" had many advantages. Dieter ______________________________________________ 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.