movielens.Rmd
Create a plot
# Load sample data
data(movieSets)
# Define set names
setNames <- movieSets %>%
select(Action:Western) %>%
colnames()
# Define ID column
idName <- "movieId"
# Define max degree
maxDegree <- 4
# Calculate set sizes
setSizes <-
getSetSizes(movieSets, setNames)
# Calculate set sizes by degree
setSizesByDegree <-
getSetSizesByDegree(movieSets, setNames, idName)
# Calculate edge data
setIntersections <-
getSetIntersections(movieSets, setNames, idName)
radialSetsData <-
getRadialSetsData(setSizes,
setSizesByDegree,
setIntersections)
buildRadialSetsPlot(
setSizes,
setSizesByDegree,
setIntersections,
linkThickness = "prop",
linkColor = "prop.relError",
linkColorPal = "RdBu",
reverseLinkPal = T,
colorScaleLim = c(-1,1),
colorScaleMapFun = "squish",
edgeWidthRange = c(1,8),
sectorColor = "white"
)
Optimize set order
buildRadialSetsPlot(
setSizes,
setSizesByDegree,
setIntersections,
linkThickness = "prop",
linkColor = "prop.relError",
linkColorPal = "RdBu",
reverseLinkPal = T,
setOrder = optOrder[c(14:19,1:13)],
colorScaleLim = c(-1,1),
colorScaleMapFun = "squish",
edgeWidthRange = c(1,8),
sectorColor = "white"
)