prepanel.trim {addScales}R Documentation

Lattice Prepanel Function to Trim Panel Limits


Trims numeric x and or y limits to specified quantiles. May be useful when unusual extreme values distort the scales and obscure informative features of the data. Scales for factors are not affected.


prepanel.trim(x, y, trim.x = 0, trim.y = 0.05, min.trim = 20, ...)


x, y

x and y values, numeric or factor.

trim.x, trim.y

Numeric trimming proportions, p, with 0 <= p < .5 .
trim.x and trim.y can be different.


The minimum number of data values needed before trimming after removing⁠NAs⁠’ and ‘⁠Infs⁠’. Otherwise the range of the data is returned (min and max of all the remaining finite values).


Other arguments, usually ignored


If the trimming proportion is p, the limits returned are essentially quantile(p, 1-p, type = 8). See quantile for details. So, for example if p = .1, roughly 10% of the lowest and 10% of the highest values are removed, and the range of the middle 80% of the data are returned. More precisely (quoting from xyplot), “... the actual limits of the panels are guaranteed to include the limits returned by the prepanel function” – i.e., these quantiles.


For numeric data, a numeric vector of length 2, as would be returned by range. For a factor, a list with components yat and ylim, as described in the prepanel section of xyplot


No banking calculations are done.


Bert Gunter

See Also

xyplot, prepanel.default.xyplot, quantile

[Package addScales version 1.0-1 Index]