slugPlot: plots a ranked violin-type plot

Description Usage Arguments Details Examples

Description

plots a ranked violin-type plot

Usage

1
2
slugPlot(values, ranking, ylim = NA, yLines = c(), yLineWidths = 1,
  breaks = 200, steps = 50, smooth = 2, overlap = 1, ...)

Arguments

values

named list: list over x-entries, each list entry a name vector of y-values. names of vector must match entries in ranking.

ranking

named list: must have entries 'red' and 'blue', containing the rank of y-value entries to be plotted on the red and blue side of the slug plot.

ylim

numeric vector: passed on to plot as usual. defaults to min and max of values.

yLines

numeric vector: y values of support lines going behind the slugs. Defaults to no lines.

breaks

numeric: number of breaks in the histogram across y. Affects .pdf dize. Default 200.

steps

numeric: Number of histograms plotted inside each other. Affects .pdf size. Default 50.

smooth

integer: The histogram is smoothed over up to smooth^2 histogram bins. Default 2.

overlap

numeric: The factor the slug will enter the neighbouring slugs area. Default 1, which is no overlap.

...

Remaining arguments are passed to plot().

yLineWidth

numeric vector: line width of support lines going behind the slugs. Defaults to 1.

Details

This function plots smoothed histograms of the values over the y-axis, similarly to violin plots. Each sample, ie entries in the values list, get a wall, with a red slug on the right side, and a blue slug on the left side. The red slug is based on the ranking in ranking$red, and shows all entries in red, and then increasingly bright colours for the top ranked values. Similary, the blue slug show the ranking of the ranking$blue on the left side of the wall.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  #set up example data
  values = lapply(1:5, function(i) {
                  ret=rnorm(1000, i-i*(1:1000)/400, 1)
                  names(ret)=1:1000
                  return(ret)
                })
  names(values) = c('a', 'b', 'c', 'd', 'e')
  ranking = list('red'=as.character(1:300), 'blue'=as.character(1000:701))

  slugPlot(values, ranking, yLines=(-5:5), yLineWidths=c(rep(1,5), 3, rep(1,5)))

ChristofferFlensburg/slugPlot documentation built on May 6, 2019, 11:48 a.m.