s-news
[Top] [All Lists]

Re: Question about boxplot

To: Brian Wu <bwu@guzman.com>, s-news@lists.biostat.wustl.edu
Subject: Re: Question about boxplot
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Wed, 15 Mar 2006 13:50:24 -0500
tmp <- list(a=rnorm(20), b=rnorm(15))
boxplot(tmp)
boxplot(tmp, ylim=c(-1,1))


## Francisco J. Zagmutt's proposal to subset the data before sending
## it to bwplot won't work as that would change the locations of the
## quartiles.  To respond to his legitmate comment about potentially
## misleading the readers you will need to indicate truncation
## information, for example:

tmp.trunc <- do.call("cbind",
                     lapply(tmp,
                            ylim=c(-1,1),
                            function(x, ylim) {
                              c(high=sum(x > max(ylim)),
                                  low=sum(x < min(ylim)))
                            })
                     )
tmp.trunc

tmp.x <- boxplot(tmp, ylim=c(-1,1))
axis(side=1, at=tmp.x, tmp.trunc["low",], pos=-.9, ticks=FALSE)
axis(side=3, at=tmp.x, tmp.trunc["high",], pos=.9, ticks=FALSE)


## Rich

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