rupsetr

Manually order intersections UpSetR


I'm trying to manually order my intersections with UpSetR but I don't know if it's possible to do it. order.by only allows freq or degree and I don't see any other parameter that could produce what I want.

a <- list(one = c(1, 2, 3, 5,11,19), 
          two = c(1, 2, 4, 5, 11, 13), 
          three = c(1, 5, 6, 7, 11, 19),
          four = c(1, 5, 6, 8, 13, 19))
upset(fromList(a), sets = c("one", "two", "three", "four"))

On the left is what I actually have, on the right is what I want to reproduce. enter image description here

Does anyone knows if it is possible? Thanks.


Solution

  • I just found the solution with ComplexUpset package :

     if(!require(devtools)) install.packages("devtools")
    devtools::install_github("krassowski/complex-upset") 
    
    
    upset(a,colnames(a),intersections=list(c("one"),c("one","two"),c("one","two","three","four"),c("one","three","four"),c("one","two","three"),c("three"),c("two"),c("four"),c("three","four"),c("two","four")),sort_intersections=FALSE)