[R] how to customize boxplot

Marc Schwartz marc_schwartz at comcast.net
Thu Jan 31 16:39:39 CET 2008

Cornelis de Gier wrote:
> Dear List,
> I'd like to make boxplots of a large number of observations (+/-
> 20.000), which are distributed log-normal and right skewed. The
> problem is that with standard boxplots a too large number of
> observations are displayed as outliers. I also tried to display the
> log of the observations, but even then there are to may outliers to my
> taste. So I'd like to change the standard IQR box to a box which
> displays the 5th tothe 95th percentile instead of the standard 25th to
> 75th percentile.
> Is this possible and if so, how? I use both R and Splus, so I'd like
> to know for both flavours of S.
> Regards,
> Cornelis


1. Adjust the 'range' argument in boxplot() to cover a larger proportion
of the data points with the whiskers.

2. Consider using the bpplot() function in Frank Harrell's Hmisc
package, which will create box-percentile plots.

3. Use an alternative type of plot, such as a histogram or density plot
to present the shape of the distribution.

Some examples here:



Marc Schwartz

More information about the R-help mailing list