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 and y values, numeric or factor.
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
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
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.