depthFill {AssocBin} | R Documentation |
Generate fills encoding bin features
Description
These functions all accept a list of bins and return a vector of colours of the same length that encode some feature of the bins.
Usage
depthFill(bins, colrng = c("white", "firebrick"))
residualFill(
bins,
resFun = binChi,
maxRes,
colrng = c("steelblue", "white", "firebrick"),
breaks = NA,
nbr = NA
)
Arguments
bins |
list of bins to be visualized |
colrng |
hue range to be passed to 'colorRampPalette' to generate the final hue scale |
resFun |
function which returns a result with a name element 'residuals' that is a numeric vector of the same length as 'bins' |
maxRes |
numeric maximum value of the residuals to maintain the correct origin, taken to be the maximum observed residual if not provided |
breaks |
numeric vector of breakpoints to control hues, defaults to breakpoints that indicate Pearson residuals outside the asymptotic 95 percent confidence interval around zero under the null |
nbr |
number of breakpoints for automatic breakpoint generation if 'breaks' is not provided |
Details
Shadings
Two functions are provided by default: one which generates a fill based on bin depth and the other based on a residual function applied to each bin.
Value
A vector of colours the same length as 'bins'.
Functions
-
depthFill()
: Fill by depth -
residualFill()
: Fill by residual values
Author(s)
Chris Salahub
Examples
bin <- makeBin(x = 1:10, y = sample(1:10))
bin2 <- halfSplit(bin, "x")
bin3 <- unlist(lapply(bin2, maxScoreSplit,
scorer = chiScores, minExp = 2),
recursive = FALSE)
plotBinning(bin3, fill = depthFill(bin3)) # all the same depth
plotBinning(bin3, fill = residualFill(bin3)) # diff resids