drawSplitDensity: Draw a Split Density Plot

Description Usage Arguments Value Author(s) Examples

View source: R/splitDensity.R

Description

Draw a Split Density Plot

Usage

1
2
3
drawSplitDensity(x = NULL, y = NULL, densityObj = NULL, yshift = 0,
  colVec, outerCol, lwd = 2, split = NULL, yScale = NULL,
  fillBackground = FALSE)

Arguments

x

x vector from a density object. e.g. data <- rnorm(100); x <- density(data)$x

y

y vector from a density object

densityObj

an object created by the function density()

yshift

vertical shift to be applied to the y object

colVec

color vector for the shaded regions that compose the interior of the plot. The length of 'colVec' should be one greater than the length of split

outerCol

the color for the outer density line

lwd

line width for the outer density line

split

vector of x values at which to split the density plot

yScale

vertical scale at which to plot the density. For example, a call with 'yScale = 1' will produce a density curve scaled between 0 and 1

fillBackground

binary specification of whether to fill in the background the outerCol color

Value

none. Graph is plotted to the current device

Author(s)

Jason Waddell

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(RColorBrewer)
data <- rnorm(1000)
x <- density(data)$x
y <- density(data)$y
colVec <- brewer.pal(9, "Blues")[3:8]
outerCol <- brewer.pal(9, "Blues")[9]

oaTemplate(xlim = range(x), ylim = c(0, 1), ygrid = 0, cex.axis = 1.2)
drawSplitDensity(x, y, colVec = colVec, split = c(-8),
		outerCol = outerCol,
		yScale = 0.95, yshift = 0)

Example output

Loading required package: oaColors

oaPlots documentation built on May 2, 2019, 6:46 a.m.