plot_alluvium: Alluvial Plot Function

Description Usage Arguments Format Examples

Description

This function allows you to plot an alluvial/Sankey diagram

Usage

1
data(melt_df)

Arguments

df

A dataframe containing each variable as a column; must be in molted form (see reshape package for details)

x_axis

the column in df containing the x axis information

grouping

the column in df containing the group identity information

weights

the column containing the y axis information

plot_title

str; title of your plot

xlab

str; x-axis label

ylab

str; y-axis label

axis_breaks

vector of how the x axis should be partitioned

has_lines

if TRUE, includes vertical line breaks separating along the axis_breaks

line_breaks

a vector that contains the x-values for where the lines should be manually placed. Only functional if has_lines = TRUE

add_values

if TRUE, includes values of the weights corresponding to the alluvium strata

Format

An object of class "dataframe"

Examples

1
2
3
4
5
yearaxes <- seq(1990, 2010, 5)
yearbreaks <- c(1991.3,1993.7,1996.3,1998.7,2001.3,2003.7,2006.3,2008.7)
plot_alluvium(df = melt_df, x_axis = melt_df$year, grouping = melt_df$factors, 
weights = melt_df$value, plot_title = "Risk Factors for Stroke in Blacks", 
xlab = "Year", ylab = "Cumulative Proportion", axis_breaks = yearaxes)

andikym/alluvium-plot documentation built on May 14, 2019, 2:28 p.m.