Learn R Programming

AssocBin (version 1.1-2)

plotBinning: Plot a binning using shaded rectangles

Description

Use a binning and vector of fill colours to visualize the sample space of pairwise data.

Usage

plotBinning(
  bins,
  fill,
  add = FALSE,
  factor = 0.5,
  xlab = "x",
  ylab = "y",
  showXax = FALSE,
  showYax = FALSE,
  border = "black",
  ...
)

Value

A list of lists each with elements `x`, `y`, `bnds`, `expn`, and `n`.

Arguments

bins

list of lists each with a named elements `x`, `y`, and `bnds`, the last of which is a list having named elements `x` and `y`

fill

vector of values which can be interpreted as colours of the same length as `bins`

add

logical, should the plot of bins be added to the current plot area?

factor

number between 0 and 1 giving the factor applied to jitter categorical variables

xlab

string, the label to be placed on the x axis

ylab

string, the label to be placed on the y axis

showXax

logical indicating whether to plot x axis markings

showYax

logical indicating whether to plot y axis markings

border

argument to be passed to `rect` internally giving the border colour

...

optional additional arguments to be passed to `plot`, `points`

Author

Chris Salahub

Details

`plotBinning` plots each bin within a list of bins with custom shading to communicate large residuals, the depth of bins, or highlight particular bins. It automatically jitters points within categorical levels to avoid overplotting.

Examples

Run this code
bin <- list(x = 1:10, y = sample(1:10),
            bnds = list(x = c(0, 10), y = c(0, 10)),
            expn = 10, n = 10, depth = 0)
bin2 <- halfSplit(bin, "x")
bin3 <- unlist(lapply(bin2, maxScoreSplit, scorer = chiScores),
               recursive = FALSE)
plotBinning(bin3)

Run the code above in your browser using DataLab