Dear R experts..
Related to the example below, (which was discussed earlier)...
How do I control the graphical elements of box, whiskers etc?  I would like
their colors go with specific groups. i tried changing
par.settings(box.umbrella, box.rectangle etc)..and could not make them
work.. Sample dataset and example code is given below.

tmp <- data.frame(
y=rnorm(100),
category=rep(factor(letters[1:
5]),each=20),
level=rep(factor(0:1), length=100))

barchart(y~factor(category),groups=level,
        data=tmp,jitter.x=F,
        panel=function(...){
        panel.superpose( ...)
        panel.superpose(panel.groups=panel.bwplot,
            alpha=c(0.5,0.5),
            varwidth=T,notch=T,
            col=c("red","blue"),
            fill=c("pink","lightblue"),pch=16,

par.settings=list(box.umbrella=list(col=c("red","blue"),box.dot=list(col=c("red","blue")))),...)

panel.superpose(panel.groups=panel.loess,lwd=2,col.line=c("red","blue"),alpha=0.2,lty=1,...)
        panel.abline(h=0,col="black",lty=2)},
        xlab="time bin (week)",
        auto.key=list(space="right",text=c("A","H"),points=T))

Thanks,
Santosh
_____________________________________
On Wed, Apr 8, 2009 at 12:07 PM, Deepayan Sarkar
<deepayan.sar...@gmail.com>wrote:

> On Wed, Apr 8, 2009 at 10:36 AM, Lyman, Mark <mark.ly...@atk.com> wrote:
> > I don't understand your first question, but, since no one else has
> > responded I can answer your second question. panel.bwplot, unlike
> > panel.xyplot doesn't use panel.superpose when groups is not NULL. In
> > order to get an analogous result you need to specify that you want to
> > use panel.superpose.
> >
> > cols <- c("Sepal.Width", "Petal.Length", "Petal.Width")
> > stackedData <- stack(iris[, cols])
> > df <- data.frame(y = stackedData$values, x = rep(iris$Species, 3), which
> > = gl(3, nrow(iris)))
> >
> > bwplot(y ~ x:which, data = df, groups = which, panel=panel.superpose,
> > panel.groups = panel.bwplot)
> >
> > If you don't like the default colors, you can set the fill colors with
> > par.settings like:
> >
> > bwplot(y ~ x:which, data = df, groups = which, panel=panel.superpose,
> > panel.groups = panel.bwplot,
> > par.settings=list(superpose.symbol=list(fill=2:4)))
>
> And to answer the first question: using panel.superpose hijacks the
> parameters of the median spot, but they can be supplied explicity:
>
> bwplot(y ~ x:which, data = df, groups = which, panel=panel.superpose,
>    panel.groups = panel.bwplot,
>     par.settings=list(superpose.symbol=list(fill=2:4)), col = "black", pch
> = 16)
>
> -Deepayan
>
> >
> > Without the groups, the fill colors are controlled like this
> > bwplot(y~x:which, data = df,
> > par.settings=list(box.rectangle=list(fill=2:4)))
> >
> > Although if you have groups, using the groups argument is probably
> > better.
> >
> > Mark Lyman
> >
> >
> > Message: 41
> > Date: Tue, 7 Apr 2009 10:50:33 +0100
> > From: Richard Weeks <dickywe...@hotmail.com>
> > Subject: [R] Lattice Groups
> > To: <r-help@r-project.org>
> > Message-ID: <blu138-w2277550025ed688aae0c91dc...@phx.gbl>
> > Content-Type: text/plain
> >
> >
> > Hi all,
> >
> >
> >
> > I'm trying to achieve a few things using the lattice package but am
> > failing miserably.
> >
> > I am plotting side by side box plots and using a grouping variable, e.g.
> >
> >
> >
> > cols <- c("Sepal.Width", "Petal.Length", "Petal.Width")
> > stackedData <- stack(iris[, cols])
> > df <- data.frame(y = stackedData$values, x = rep(iris$Species, 3), which
> > = gl(3, nrow(iris)))
> >
> > bwplot(y ~ x:which, data = df, group = which, panel.groups =
> > panel.bwplot)
> >
> >
> >
> > My questions are
> >
> > 1) How am I able to retain the median spot in the boxes?
> >
> > 2) How can I change the fill using the par.settings argument rather than
> > fill =1:3 say?
> >
> >
> >
> > Best wishes,
> >
> >
> >
> > Biff
> >
> > ______________________________________________
> > 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.
> >
>
> ______________________________________________
> 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.
>

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