densityplot: Kernel Density Plot

Description Usage Arguments Author(s) Examples

View source: R/MTfuncs_all.R

Description

Produces a kernel density plot of up to five vectors (this can be biggerized)

Usage

1
2
3
densityplot(a, b, c = NULL, d = NULL, e = NULL, xlab = "",
  ylab = "Density", main = "", lty = 0, lwd = 2, col = 1,
  labels = NULL, yinfl = 1.4, showN = TRUE, bwall = NULL, ...)

Arguments

a

Input vector

b

Input vector

c

Input vector

d

Input vector

e

Input vector

xlab

Just like usual

ylab

Just like usual

main

Just like usual

lty

Line type. Accepts one value or a vector of values for each line. Specifying zero will automatically generate one line type for each line.

lwd

Line width. Accepts one value or a vector of values for each line. Specifying zero will automatically generate one line width for each line.

col

Line color. Accepts one value or a vector of values for each line. Specifying zero will automatically generate one line color for each line.

labels

A vector of labels for the legend.

yinfl

Inflation factor for determining plotting window size. Setting yinfl=1 will use the maximum density value. Setting it slightly higher (the default value is 1.4) allows more space for a legend.

showN

Whether to include sample sizes in the legend. Defaults to TRUE.

...

Additional plotting arguments

Author(s)

Matt Tyers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
a <- rnorm(100)
b <- rnorm(100)
c <- rnorm(100,1,1)
d <- rnorm(100,0,2)
densityplot(a,b,c,d,labels=c("apples","bananas","cucumbers","durians"))
densityplot(a,b,c,d,labels=c("apples","bananas","cucumbers","durians"),col=0,lty=1)
cols <- rainbow(4)
densityplot(a,b,c,d,labels=c("apples","bananas","cucumbers","durians"),col=cols,lty=1,yinfl=1)

a <- rnorm(10)
b <- rnorm(20)
c <- rnorm(100,1,1)
d <- rnorm(100,0,2)
densityplot(a,b,c,d,labels=c("apples","bananas","cucumbers","durians"),col=0,lty=1)
densityplot(a,b,c,d,labels=c("apples","bananas","cucumbers","durians"),col=0,lty=1,bwall=.4)

mbtyers/MTfuncs documentation built on May 22, 2017, 12:16 a.m.