set.seed(666) knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(SetSysVis) library(GGally)
First, we need to generate a set system we want to visualize. To do this we use function generateClosedFamily
.
A <- generateClosedFamily(6, 6) knitr::kable(A)
We want to generate names vector for our system as well.
names <- generateNamesVector(A)
We can generate four types of matrices
M1 <- generateCommonElementMatrix(A) M2 <- generateInclusionMatrix(A) M3 <- generateInclusionTreeMatrix(A) M4 <- generateDisjointTrees(A)
To visualize the set we need the package GGally
. The first three matrices are simple.
ggnet2(M1, label = names)
ggnet2(M2, label = names)
ggnet2(M3, label = names)
When it comes to the fourth matrix, the function returns a two-element list of a matri and vector of colors, to make the sets more distinguishable.
ggnet2(M4[[1]], label = rownames(M4[[1]]), color = M4[[2]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.