alluvial: Alluvial Plot

Description Usage Arguments Details Note Author(s) Examples

Description

Function to plot an alluvial plot.

Usage

1
alluvial(..., freq, col = "gray", border = 0, layer, hide = FALSE, alpha = 0.5, gap.width = 0.05, xw = 0.1, cw = 0.1, las = 0, srt = 90, blocks = TRUE, pct=FALSE, xlabels = NULL)

Arguments

...

vectors or data frames, all for the same number of observations

freq

numeric, vector of frequencies of the same length as the number of observations

col

vector of colors of the stripes

border

vector of border colors for the stripes

layer

numeric, order of drawing of the stripes

hide

logical, should particular stripe be plotted

alpha

numeric, vector of transparency of the stripes

gap.width

numeric, relative width of inter-category gaps

xw

numeric, the distance from the set axis to the control points of the xspline

cw

numeric, width of the category axis

las

See par

srt

See par

blocks

logical, whether to use blocks to tie the flows together at each category, versus contiguous ribbons (also admits character value "bookends")

pct

logical, whether category labels should be accompanied by relative frequencies.

sep

If pct=TRUE, then it chooses the separator to concatenate category's labels and their relative frequencies.

xlabels

Either NULL or a character vector with length equal to the number of columns in the data.frame. If NULL, the labels for the horizontal axis are taken from the column names of the data.frame. If a character vector is provided, the horizontal axis' labels are taken from this vector.

Details

This function plots an alluvial plot, which is a variant of a parallel coordinates plot for qualitative data.

Note

This function imports col2rgb and rgb from the grDevices package, and plot, xspline, axis, rect, polygon, text and par from the graphics package.

Author(s)

Michal Bojanowski and Aaron Rendahl

Examples

1
2
3
4
5
6
# load packages and prepare data
tit <- as.data.frame(Titanic)
 
alluvial( tit[,1:4], freq=tit$Freq, border=NA,
         hide = tit$Freq < quantile(tit$Freq, .50),
         col=ifelse( tit$Survived == "No", "red", "gray") )

osmarllq/myFun documentation built on May 24, 2019, 4:53 p.m.