[R] Problem with bwplot and panel.abline

Deepayan Sarkar deepayan at stat.wisc.edu
Mon Apr 19 16:40:52 CEST 2004


Your example is not reproducible. The following gives what I would 
expect (even with your modified settings):

data(singer)
bwplot(voice.part ~ height, data=singer, 
       panel=function(x,y,...) {
           panel.abline(v=65)
           panel.bwplot(x,y,...)
       })

My suspicion is that what you are seeing has to do with your modified 
settings and nothing to do with "bwplot and panel.abline" as your 
subject suggests.

Deepayan

On Monday 19 April 2004 09:20, W. C. Thacker wrote:
> When plotting box & whisker plots to show the distributions of
> residuals of several models, it would be useful to add a vertical
> line to indicate zero residuals.  By adding an explicit panel
> function that includes panel.abline and panel.bwplot, it is possible
> to get the vertical line, but the median is no longer indicated.
>
> The problem seems to be with panel.bwplot ---  omitting panel.abline
> does not restore the median indicator.  Adding pch=16 explicitly as
> an argument to panel.bwplot does restore the dot, but in a strange
> color (yellow).  Adding col="black" explicitly as an argument to
> panel.bwplot makes the background black.
>
> Any suggestions would be highly appreciated.
>
> platform sparc-sun-solaris2.9
> arch     sparc
> os       solaris2.9
> system   sparc, solaris2.9
> status
> major    1
> minor    8.0
> year     2003
> month    10
> day      08
> language R
>
> > rlm1.residuals[1,]
>
>    p      rlm1
> 1 25 0.1878673
>
> postscript(file="bw.residual.verification.eps",horizontal=F,paper="le
>tter") trellispar <- trellis.par.get("plot.symbol")
> trellispar$pch <- "."
> trellis.par.set("plot.symbol",trellispar)
> trellispar <- trellis.par.get("box.dot")
> trellispar$cex <- 0.4
> trellispar$col <- "black"
> trellis.par.set("box.dot",trellispar)
> trellispar <- trellis.par.get("box.umbrella")
> trellispar$lty <- 1
> trellis.par.set("box.umbrella",trellispar)
> bwplot(-p~rlm1,
>     data=rlm1.residuals,
> as.table=TRUE,
> panel = function(x,y,subscripts,...){
>         panel.abline(v=0,lty=3,lwd=1,col="red")
>         panel.bwplot(x,y,subscripts,pch=16,...)},
> scales=list(x=list(cex=0.7),
>             y=list(tick.number=length(where),
>                             at=length(where):1,
>                          labels=format(where),
>                             cex=0.7)),
>  xlab = "measured salinity - estimated salinity (psu)",
>  ylab = "pressure (dbar)",
>   sub = list("lm(s~t+I(t^2))",font=1),
> main=list(paste(format(length(unique(P0.verification$id))),
> "verification profiles"),font=1))
> dev.off()
>
> Thanks,
>
> Carlisle
>
> William Carlisle Thacker
>
> Atlantic Oceanographic and Meteorological Laboratory
> 4301 Rickenbacker Causeway, Miami, Florida 33149 USA
> Office: (305) 361-4323           Fax: (305) 361-4392
>
> "Too many have dispensed with generosity
>      in order to practice charity."     Albert Camus
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list