rcomplex-upset

Set the colour for elements that are outside every sets in upset plot with ComplexUpset


I'm making an upset plot with ComplexUpset and I can't find a way to set the colour for the elements that are outside all my sets.

For instance :

library(ComplexUpset)

abc_data = create_upset_abc_example()

upset(abc_data,
      intersect = c('A', 'B', 'C'))

gives

enter image description here

and I would like to set the colour for the bar corresponding to the 2 elements that are outside A, B and C.

I tried

upset(abc_data,
      intersect = c('A', 'B', 'C'),
      upset_query(set = '', fill = 'red') 

and

upset(abc_data,
      intersect = c('A', 'B', 'C'),
      upset_query(intersection = c(), fill = 'red') 

or

upset(abc_data,
      intersect = c('A', 'B', 'C'),
      upset_query(intersection = c(""), fill = 'red') 

but it's not working.


Solution

  • Comparing to the examples in the package vignette (vignette("Examples_R", package="ComplexUpset")), you need to add the upset_query to the queries= parameter

    upset(abc_data,
          intersect = c('A', 'B', 'C'),
          queries = list(upset_query(intersect = NA, fill = 'red')))
    

    enter image description here