clip_fun: Get data clipping function.

View source: R/rglactions.R

clip_funR Documentation

Get data clipping function.

Description

Get data clipping function to use in rglactions as 'trans_fun' to transform data. This is typically used to limit the colorbar in a plot to a certain range. This uses percentiles to clip. Clipping means that values more extreme than the gĂ­ven quantiles will be set to the quantile values.

Usage

clip_fun(lower = 0.05, upper = 0.95)

Arguments

lower

numeric. The probability for the lower quantile, defaults to '0.05'.

upper

numeric. The probability for the upper quantile, defaults to '0.95'.

Value

a function that takes as argument the data, and clips it to the requested range. I.e., values outside the range will be set to the closest border value. Designed to be used as rglactions$trans_fun in vis functions, to limit the colorbar and data range.

See Also

rglactions

Examples

   rglactions = list("trans_fun"=clip_fun(0.10, 0.90));
   rglactions = list("trans_fun"=clip_fun());
   f = clip_fun();
   f(rnorm(100));


dfsp-spirit/fsbrain documentation built on Nov. 28, 2024, 10:29 a.m.