Description Usage Arguments Format Examples
This function allows you to plot an alluvial/Sankey diagram
1 | data(melt_df)
|
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 |
An object of class "dataframe"
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.