@ Gabor: Thanks, it worked.

@ All: Which options I should explore to change the appearance of boxes.
Like,

1. Color change.
2. Fill-in boxes with colors.
3. Change dot to line (used to represent median)
4. No gaps between boxplots in each category.

# R Code:
g <- rep.int(c("A", "B", "C", "D"), 125)
t <- rnorm(5000)
a <- sample(t, 500, replace=TRUE)
b <- sample(t, 500, replace=TRUE)
dta <- data.frame(val = sample(t,1000), g = gl(4, 250, labels=c("A", "B",
"C", "D")) , G2 = gl(2,1, labels=c("XX", "YY")))
library(lattice)
bwplot(val ~ g | G2, dta)

Thanks,
Gary

On Thu, Dec 17, 2009 at 10:09 PM, Gabor Grothendieck <
ggrothendi...@gmail.com> wrote:

> Try this:
>
> bwplot(val ~ g | G2, dta)
>
>
> On Thu, Dec 17, 2009 at 9:34 PM, Gary Miller <mail2garymil...@gmail.com>
> wrote:
> > Hi R Users,
> >
> > Is there a equivalent function for the following R code in Lattice
> package.
> > I want to plot a grouped box plots (grouped by two factors).
> >
> > g <- rep.int(c("A", "B", "C", "D"), 125)
> > t <- rnorm(5000)
> > a <- sample(t, 500, replace=TRUE)
> > b <- sample(t, 500, replace=TRUE)
> > dta <- data.frame(val = sample(t,1000), g = gl(4, 250, labels=c("A", "B",
> > "C", "D")) , G2 = gl(2,1, labels=c("XX", "YY")))
> > # ggplot2 package required
> > p <- ggplot(dta, aes(factor(G2), val))
> > p + geom_boxplot(aes(fill = factor(g)))
> >
> > Any suggestion would be highly appreciated!
> > Gary
> >
> >        [[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<http://www.r-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

        [[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