plotParallel | R Documentation |
This function uses the ggforce package to produce a parallel sets diagram for visualising interaction between 2 variables.
plotParallel(
lab1,
lab2,
labels = c("label1", "label2"),
color = NULL,
add_counts = FALSE,
add_breakdown = FALSE,
text_size = 5,
xlab_size = 14,
theme_size = 18
)
lab1 , lab2 |
Each is a character vector containing membership information. |
labels |
A character vector of length 2 containing the labels for
|
color |
A character vector of colour codes indicating the colours of
the elements in the parallel sets diagram. Default is |
add_counts |
Logical scalar indicating whether to show total counts
of each element with the labels. Default is |
add_breakdown |
A string to control which side to show the detailed
breakdown of counts. Allowable character values are |
text_size |
A numeric scalar indicating the size of membership labels. Default is 5. |
xlab_size |
A numeric scalar indicating the size of main categorical label. Default is 14. |
theme_size |
A numeric scalar indicating the base font size. Default is 18. |
A ggplot
object
I-Hsuan Lin
ggforce::geom_parallel_sets()
library(ggforce)
data <- as.data.frame(Titanic)
plotParallel(data$Class, data$Age, labels = c("class", "age"))
# Load demo dataset
data(sce)
plotParallel(sce$label, sce$CellType,
labels = c("Cluster", "Cell Type"),
add_counts = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.