s-news
[Top] [All Lists]

Re: S-plus: Adding abline to bwplot or boxplot with log scales

To: s-news@wubios.wustl.edu
Subject: Re: S-plus: Adding abline to bwplot or boxplot with log scales
From: "Tat, Tri Vi (TGRD)" <TTat@tgrd.com>
Date: Fri, 7 Sep 2007 16:25:56 +0100
Cc: "Sundar Dorai-Raj" <sundar.dorai-raj@pdf.com>
In-reply-to: <46E1663F.7080604@pdf.com>
Thread-index: AcfxXwiNPtv3xmYMTyejDJVw/e+2awAADduA
Thread-topic: [S] S-plus: Adding abline to bwplot or boxplot with log scales
Dear splus users
I wish to produce a boxplot with a log scale (because it's a 
proportional difference) and with an overlaid abline (set at 1)

1. The splus boxplot command ignores log="y".
2. The splus bwplot command allows log scale via specifying 
scales=(list(log=F)), but then it ignores the command abline or 
panel.abline when the scale is logged.

I can achieve the plot in R using boxplot because it recognises the 
log="y" option.
How do I do it in splus? 
Please find code below.

Thanks for your anticipated advice.
Tri
========================================
Example code:

#Data 
data<-data.frame(values=exp(rnorm(20, .2, .5)), # within-subject
proportional differences
        group=rep(c("A","B"),each=10) # stratification
) 

#boxplot -- fails because it ignores the log scale request
boxplot(split(data$values,data$group),log="y")
abline(h=1,lwd=1,lty=4,col=5) 

# bwplot -- fails because it ignores abline
bwplot(group~values,data=data,
        scales=list(x=list(log=T)),
)
abline(v=1,lwd=1,lty=4,col=5)

# bwplot -- again fails because it ignores abline
bwplot(group~values,data=data,
        panel=function(x,y,...){
                panel.bwplot(x,y)
                panel.abline(v=1,lwd=1,lty=4,col=5)
        }
)

Whereas in R, the following is successful because it recognises log="y":
boxplot(split(data$values,data$group),log="y")
abline(h=1,lwd=1,lty=4,col=5)



###
This message is for the designated recipient only and may contain privileged or 
confidential information.  If you have received it in error, please notify the 
sender immediately and delete the original.  Any other use of the email by you 
is prohibited.


###


<Prev in Thread] Current Thread [Next in Thread>