wrGraph (version 1.1.0)

vioplotW: Violin-plots version W

Description

This function allows generating Violin plots) using a variety of input formats and offers additional options for colors. Main input may be multiple vectors, a matrix or list of multiple data-elements (entries may be of variable length), individual colors for different sets of data or color-gradients can be specified, and the display of n per set of data was integtated (based on an inspiration from Nabble). It is also possible to plot pairwise half-violins for easier pairwise-comparisons (using halfViolin="pairwise"). Many arguments are kept similar to vioplot (here, the package vioplot is not required). Note : Arguments have to be given with full names, lazy evaluation of arguments will not work properly with this function (since '...' is used to capture additional data-sets). Note : vioplot offers better options for plotting formulas

Usage

vioplotW(
  x,
  ...,
  finiteOnly = TRUE,
  halfViolin = FALSE,
  boxCol = "def",
  hh = NULL,
  ylim = NULL,
  nameSer = NULL,
  cexNameSer = NULL,
  horizontal = FALSE,
  col = "rainbow",
  border = "black",
  xlab = NULL,
  cexLab = NULL,
  cexAxis = NULL,
  lty = 1,
  pointCol = NULL,
  cexPt = NULL,
  tit = NULL,
  las = 1,
  lwd = 1,
  rectCol = "black",
  at = 0,
  add = FALSE,
  wex = 1,
  silent = FALSE,
  callFrom = NULL
)

Arguments

x

(matrix, list or data.frame) data to plot, or first series of data

...

(numeric) additional sets of data to plot

finiteOnly

(logical) eliminate non-finite elements to avoid potential errors (eg when encountering NA)

halfViolin

(logical or character) decide with TRUE or FALSE if full or only half of violins should be plotted, if "pairwise" always 2 data-sets will be plotted back-to-back

boxCol

(character) decide if boxplot should be adde inside the violin, use "def" for default transparent grey

hh

(numeric, length <4) smoothing parameter (standard deviation to kernel function, if omited anormal optimal smoothing parameter is used); equivalent to argument h in package vioplot ; see also sm.density

ylim

(NULL or numeric, length=2) custom limit on y-axis, see also par

nameSer

(character) custom label for data-sets or columns (length must match number of data-sets)

cexNameSer

(numeric) size of individual data-series labels as cex-expansion factor (see also par)

horizontal

(logical) orientation of plot

col

(character or integer) custom colors or gradients like 'rainbow', 'grayscale', 'heat.colors', 'topo.colors', 'Spectral' or 'Paired', or you may use colors made by the package colorRamps

border

(character) custom color for figure border

xlab

(character) custom axis label

cexLab

(numeric) size of axis labels as cex-expansion factor (see also par)

cexAxis

(numeric) size of numerix axis labels as cex-expansion factor (see also par)

lty

(integer) line-type for linear regression line (see also par)

pointCol

(character or numeric) display of median: color (defauly white)

cexPt

(numeric) display of median : size of point as cex-expansion factor (see also par)

tit

(character) custom title to figure

las

(integer) orientation of axis labels (see also par)

lwd

(integer) width of line(s) (see also par)

rectCol

(character) color of rectangle

at

(numeric) custom locoation of data-series names, ie the points at which tick-marks are to be drawn, will be passed to axis, it's length ust match the number of data-sets

add

(logical) add to existing plot if TRUE

wex

(integer) relative expansion factor of the violin

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Value

figure only

See Also

the package vioplot, sm is used for the density estimation

Examples

Run this code
# NOT RUN {
set.seed(2013)
dat6 <- matrix(round(rnorm(300)+3,1), ncol=6, 
	 dimnames=list(paste("li",1:50,sep=""), letters[19:24])) 
vioplotW(dat6)
## variable number of elements (each n is displayed)
dat6b <- apply(dat6,2,function(x) x[which(x <5)])
dat6b[[4]] <- dat6b[[4]][dat6b[[4]] <4]
vioplotW(dat6b, col="Spectral")
vioplotW(dat6b, col="Spectral" ,halfViolin="pairwise", horizontal=TRUE)
vioplotW(dat6b, col="Spectral", halfViolin="pairwise", horizontal=FALSE)
# }

Run the code above in your browser using DataLab