[R] outliers

Jason Turner jasont at indigoindustrial.co.nz
Fri Apr 9 00:25:33 CEST 2004


mike.campana at freesurf.ch wrote:

> Dear all
> 
> I would like to represent the outliers in the plot. These few outliers 
> are much larger than the limit of 50 in the ylim-argument.
> 
> plot(daten$month~daten$no,ylim=c(0,50))
> 
> I know that it is possible to introduce the information about the 
> presence of outliers without changing the range of the axis. Do you have 
> an advice? I hope the question is understandable!!

Three things come to mind --

1) Use a logarithmic y-axis.
2) Put text directly on the plot, stating where outliers are.
3) Use layout() and margin and axis settings of par() to stack two plots 
one above the other, with different y-ranges, like this:

## layout of a split-range plot

## fake data

zz <- runif(100,0,35)
zz[sample(seq(along=zz),10)] <- runif(10,90,100)

par(mfcol=c(2,1))
par(mai=c(0, 1, 0.25,0.5))
plot(zz,ylim=c(80,100),xaxt="n",ylab="Outliers")
par(mai=c(1,1,0,0.5))
plot(zz,ylim=c(0,50),ylab="Nice data")

Hope that helps

Jason




More information about the R-help mailing list