Hello Xin,

Take a look at the examples under ?print.trellis

Using your original example, you could use:

require(lattice)
p1=barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6),
         ylab = "Barley Yield (bushels/acre)",
         scales = list(x = list(abbreviate = TRUE,
                       minlength = 5)))
p2=barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6), stack = TRUE,
         ylab = "",
scales = list(x = list(rot = 45))) #I removed the legend and ylab to make it look a bit better


print(p1, split=c(1,1,2,1), more=TRUE)
print(p2, split=c(2,1,2,1))


I hope this helps,

Francisco

Francisco J. Zagmutt
Vose Consulting
1643 Spruce St., Boulder
Boulder, CO, 80302
USA
www.voseconsulting.com

Xin Ge wrote:
Hi All,

I'm trying par(mfrow(c(1,2))) with barchart(), but its not working. Can I
display two or more barcharts on a same page using some other function? I'm
using following code --- where barchart() part is taken from help manual.

library(lattice)
par(mfrow=c(1,2))
barchart(yield ~ variety | site, data = barley,
         groups = year, layout = c(1,6),
         ylab = "Barley Yield (bushels/acre)",
         scales = list(x = list(abbreviate = TRUE,
                       minlength = 5)))
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)))
par(mfrow=c(1,1))

Thanks,
Xin

        [[alternative HTML version deleted]]


______________________________________________
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