rupsetr

How to manually order the set size bar plot of UpsetR


I have the following code:

library(UpSetR)

listInput <- list(one = c(1, 2, 3, 5, 7, 8, 11, 12, 13), 
                  two = c(1, 2, 4, 5, 10),
                  three = c(1, 5, 6, 7, 8, 9, 10, 12, 13))

upset(fromList(listInput))

which produces this plot:

enter image description here

As you can see currently the barplot on the left is ordered according to size. I'd like to order it from top to bottom as: three, two, one.

How can I achieve that?


Solution

  • You can manually order the sets by inputting them manually to set and setting keep.order=TRUE

    upset(fromList(listInput[c(1,2,3)]), 
          keep.order = T, 
          sets = c("one", "two", "three"))
    

    enter image description here