For all examples the movies data set contained in the package will be used.
library(UpSetR)
movies <- read.csv(system.file("extdata", "movies.csv", package = "UpSetR"),
header = T, sep = ";")
When not specifying specific sets, nsets
selects the n largest sets from the data. number.angles
determines the angle (in degrees) of the numbers above the intersection size bars. point.size
changes the size of the circles in the matrix. name.size
changes the size of the set names. line.size
changes the size of the lines connecting the circles in the matrix.
upset(movies, nsets = 6, number.angles = 30, point.size = 5, name.size = 12,
line.size = 2)
To look at specific sets, a vector of set names can be entered into the sets
parameter. To change the proportions of the plot heights assigned to the matrix and intersection size bar plot, use the mb.ratio
parameter entered as percentages. If no order is specified, the matrix will be ordered by degree, then frequency. The 3 plots below show different ways the data can be ordered.
upset(movies, sets = c("Action", "Adventure", "Comedy", "Drama", "Mystery",
"Thriller", "Romance", "War", "Western"), mb.ratio = c(0.55, 0.45), order.by = "freq")
upset(movies, sets = c("Action", "Adventure", "Comedy", "Drama", "Mystery",
"Thriller", "Romance", "War", "Western"), mb.ratio = c(0.55, 0.45), order.by = "degree")
upset(movies, sets = c("Action", "Adventure", "Comedy", "Drama", "Mystery",
"Thriller", "Romance", "War", "Western"), mb.ratio = c(0.55, 0.45), order.by = c("degree",
"freq"))
Instead of the default method of grouping by degree, grouping by sets can be acheived using group.by
. To set a cutoff for the number of intersections per group of sets use cutoff
.
upset(movies, nintersects = 70, group.by = "sets", cutoff = 7)
There may be times where an intersection you are looking for is not present in the matrix. This may be due to not showing enough intersections which can be changes with nintersects
, or it may be because the intersection contains no elements. To additionally show empty intersections turn on empty.intersections
.
upset(movies, empty.intersections = "on", order.by = "freq")