violinPlot: Draw a Violin Plot

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

Adds a violin plot to an already existing figure.

Usage

1
violinPlot(x, pos, scaleH = 0.5, est = T, interval = list(), ...)

Arguments

x

a vector of values used to create the violin plot, or a named list where X is the x-axis values and y is the associated density.

pos

the x-axis position at which to draw the violin plot

scaleH

the maximum half-width of the violin plot.

est

a logical value; if true, the density is empirically estimated, otherwise the density is extracted from the list x.

interval

allows for extra options governing ways to restrict the violin plot to a desired sub-interval.

crit

a critical value or pair of values that determines the sub-interval to plot over.

type

when crit takes on a single value, 'greater' restricts the sub-interval to values larger than crit,'less' to values below crit.

out

a logical value; if true, the function returns the proportion of values above, below, or within crit.

...

additional plotting parameters for polygon.

Value

If out is set to TRUE, returns the proportion of values in x above, below, or within the interval defined by crit.

Examples

1
2
3
4
5
6
x = rnorm(100)
blankPlot(yDim=c(-6,6))
crit = mean(x)
violinPlot( x, .5, interval = list( crit = crit ), col = 'grey',
  border = NA )
violinPlot( x, .5, lwd = 2 )

rettopnivek/utilityf documentation built on March 1, 2021, 7:05 p.m.