[R] label outliers in boxplot and/or bwplot

John Fox jfox at mcmaster.ca
Sat Feb 12 16:04:05 CET 2005


Dear Deepayan,

I wasn't aware of panel.identify(), which I too will find very useful. As
you say, it is strange that you can identify points that aren't plotted;
this is the case for my solution for boxplot() as well -- though the reason
it works there is more obvious (at least to me).

Thanks,
 John

--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
-------------------------------- 

> -----Original Message-----
> From: Deepayan Sarkar [mailto:deepayan at stat.wisc.edu] 
> Sent: Friday, February 11, 2005 10:43 PM
> To: r-help at stat.math.ethz.ch
> Cc: John Fox; 'Christoph Lehmann'
> Subject: Re: [R] label outliers in boxplot and/or bwplot
> 
> On Friday 11 February 2005 21:20, John Fox wrote:
> > Dear Christoph,
> >
> > (I don't believe that this question was answered; my apologies if it
> > was.)
> >
> > > -----Original Message-----
> > > From: r-help-bounces at stat.math.ethz.ch 
> > > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Christoph 
> > > Lehmann
> > > Sent: Friday, February 11, 2005 8:44 AM
> > > To: r-help at stat.math.ethz.ch
> > > Subject: [R] label outliers in boxplot and/or bwplot
> > >
> > > Hi
> > >
> > > Is there a way to lable (e.g. observation-number) the 
> outliers in a 
> > > boxplot?
> >
> > You can use identify() with horizontal coordinates at 1 (and at 
> > successive integers for parallel boxplots); e.g.,
> >
> > x <- c(rnorm(98), 8, 10)
> > boxplot(x)
> > identify(rep(1, 100), x)
> >
> > > and in a bwplot?
> >
> > Not to my knowledge.
> 
> Actually, it turns out that the obvious analog works with 
> bwplot too (though it's a bit weird that you can 'identify' 
> points that are not actually plotted). See below.
> 
> > I hope this helps.
> >  John
> >
> > > thanks a lot
> > >
> > > Christoph
> > >
> > >
> > > P.S. identify() is not available with bwplot, is it?
> 
> There's panel.identify(). You could use it as part of your 
> panel function, but in this case it might be more natural to 
> do it after the fact, as in:
> 
> bwplot(x)
> trellis.focus("panel", 1, 1)
> panel.identify()
> trellis.unfocus()
> 
> This has the added advantage that you don't have to specify 
> 'x' and 'y' 
> explicitly, they're taken from the corresponding panel data.
> 
> Deepayan




More information about the R-help mailing list