| alluvialPlot | R Documentation |
<summarised_result> object.Create an alluvial plot visualisation from a data frame or a
<summarised_result> object.
alluvialPlot(result, x, y, colour = x, facet = NULL, style = NULL, type = NULL)
result |
A |
x |
A character vector of column names to use as alluvial axes, in order from left to right. Must contain at least 2 elements. |
y |
Column or estimate name that is used as y variable. |
colour |
Columns to use to determine the colours. |
facet |
Variables to facet by, a formula can be provided to specify which variables should be used as rows and which ones as columns. |
style |
Visual theme to apply. Character, or |
type |
Character string indicating the output plot format.
See |
A plot object.
result <- dplyr::tibble(
treatment_1 = c("A", "A", "A", "B", "B", "B", "C", "C"),
treatment_2 = c("A", "A", "B", "A", "B", "B", "B", "C"),
treatment_3 = c("A", "B", "B", "A", "A", "B", "B", "C"),
count = c(22, 3, 5, 7, 3, 17, 4, 12)
)
# basic alluvial plot with 3 axes
alluvialPlot(
result = result,
x = c("treatment_1", "treatment_2", "treatment_3"),
y = "count"
)
# colour by first axis
alluvialPlot(
result = result,
x = c("treatment_1", "treatment_2", "treatment_3"),
y = "count",
colour = "treatment_1"
)
# colour by multiple variables
alluvialPlot(
result = result,
x = c("treatment_1", "treatment_2", "treatment_3"),
y = "count",
colour = c("treatment_1", "treatment_2")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.