# Re: [R] Lattice box percentile plot

From: Mr Derik <mr418_at_cam.ac.uk>
Date: Tue, 20 May 2008 07:01:12 -0700 (PDT)

Hello

I have just worked out how to do it. You take the code for panel.bpplot and near the top of the code replace lline with lpolygon. Then it take the \$fill paramiter from the trellis settings. Seems to work, though I need to check it isn't doing something wierd.

function (x, y, box.ratio = 1, means = TRUE, qref = c(0.5, 0.25,

0.75), probs = c(0.05, 0.125, 0.25, 0.375), nout = 0, datadensity = FALSE,
scat1d.opts = NULL, font = box.dot\$font, pch = box.dot\$pch,     cex = box.dot\$cex, col = box.dot\$col, ...) {

if (.R.) {

require(lattice)
}
grid <- .R.
if (grid) {

```        lines <- lpolygon ###########replace "lline" with "lpolygon"
points <- lpoints
segments <- lsegments

```

Yasir Kaheil wrote:

```>
> it's a good question.. my guess is using "panel.bpplot" prevents filling
> in the shape "the coffins"- since the box is now two mirrored graphs. i
> hope i'm wrong.
>
> trellis.par.get()
> br = trellis.par.get("box.rectangle")
> br\$col = "black"
> br\$fill = "lightblue"  #this is the parameter that fills in the box, but
> it doesn't work with panel.bpplot
> trellis.par.set("box.rectangle", br)
> bwplot(B~A,probs=seq(.01,.49,by=.01))
>
> thanks
> y
>
>
> Mr Derik wrote:
```

>>
>> Dear Nabble.
>>
>> I am trying to draw a box percentile plot with trellis using the panel in
>> Hmisc. I really want to colour the plots in. I can alter several of
>> features of the plot by changing the trellis par settings but I just
>> can’t fill the shape in.
>>
>> Here is some example code which alters line colour and dot symbol:
>>
>> require(lattice)
>> require(Hmisc)
>> A<-c(rnorm(100,50,2),rnorm(100,60,5),rnorm(100,55,7))
>> B<-rep(c(1,2,3),each=100)
>>
>> trellis.par.set(list(box.rectangle=list(col="black")))
>> trellis.par.set(list(box.umbrella=list(col="black")))
>> trellis.par.set(list(box.dot=list(pch=3,col="red")))
>>
>> bwplot(B~A,panel=panel.bpplot, probs=seq(.01,.49,by=.01))
>>
>> I’d really appreciate it if someone could tell me how to change the fill
>> colour as well as it is driving me mad.
>>
>> Chears.
>>
>>
>
>
```--
View this message in context: http://www.nabble.com/Lattice-box-percentile-plot-tp17274559p17341075.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help