Re: [R] outliers in boxplot

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [R] outliers in boxplot
From: Uwe Ligges (ligges@statistik.uni-dortmund.de)
Date: Sat 13 May 2000 - 04:19:21 EST


Message-ID: <391C4B29.46F4C333@statistik.uni-dortmund.de>

Angelo Canty wrote:
>
> Hi All,
>
> I'm trying to draw a number of sidee-by-side boxplots with quite a
> large number of outliers. The default in R is to plot these using
> the current value of par("pch"). I would like to plot them as
> horizontal lines of length k times the width of the boxes. Essentially
> what I want is the equivalent of the S-Plus parameters
> outline=T, outwex=k
> which do not seem to exist in the R version of boxplot.
>
> Also the helpfile for boxplot says that graphical parameters can be
> passed but the pch parameter is ignored if supplied. Is this
> intentional?

You are right, outline=T and outwex=k does not exist.
And not all grahical parameters can be passed (e.g. pch or lty).

To change "pch", try something like
  par(pch="*")
  boxplot(.)

If you want to plot outliers as lines, you should have a deeper look
into that method:
To produce the plot, bxp(.) is called by boxplot.default(.).
So you should modify that function.

Example:

   temp <- boxplot(c(1:5, 10))
   temp
   ## necessary informations for bxp(.)
   ## (e.g. median, ..., outliers)
   my.bxp <- bxp ## Make your own boxplot function
   fix(my.bxp) ## modify it (described below)
   my.bxp(temp) ## and draw the plot :-)

In my.bxp(.) you have to change line 30:

   ## Replace:
   points(rep(x, length(out)), out, col = border) # draws outliers
   ## by something like:
   if (length(out) > 0)
       segments(x - wid/2, out, x + wid/2, out, col = border)
   ## "wid" is length of the lines here.

Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Mon 17 Jul 2000 - 12:33:19 EST