Skip to contents

Plot the density of binned elements with binning information.

Usage

plotBinDensity(
  x,
  b,
  xlab = deparse(substitute(x, env = as.environment(-1))),
  ylab = "Density",
  main = "",
  legendPosition = "right",
  legend = NULL,
  legend.cex = NULL,
  ...
)

Arguments

x

A numerical vector with the values used for binning.

b

A factor that groups elements of x into bins (typically the output of bin).

xlab, ylab, main

character scalars that set the x-axis label, y-axis label and the main title. Use "" to suppress the label.

legendPosition

A character scalar. If not "none", draw a legend with binning information. The value is used to control the legend position and will be passed to theme(legend.position = legendPosition).

legend

Deprecated (ignored). Please use legendPosition to control the drawing and position of the legend.

legend.cex

Deprecated (ignored). You can use theme to set legend and other graphical parameters.

...

Further arguments passed to getColsByBin.

Value

The generated density plot as a ggplot object.

Examples

set.seed(1)
x <- rnorm(100)
b <- bin(x, "equalN", nElements = 10)
plotBinDensity(x, b)