Ok, moved it to answer!
Actually, It's a copy of my question on stack overflow: https://stackoverflow.com/questions/62232443/upsetr-how-to-display-all-possible-intersections-how-to-change-margins-of-ups
I'm looking for someone who has faced some similar problems with UpSetR.
I have 10 sets and several hundreds of items to inspect possible intersections. I have 2 problems with upset plots:
Not all intersections are displayed (in the pictures below you can see there are no "1" or "2" unique categories displayed when grouped by freq., or many groups with large numbers of items are not displayed when grouped by degree). The margins of the plot are set in such a way that I can't see how many items there are per set. The code is attached, you can check the illustration on stack overflow.
By frequency:
upset(UpDown, nsets = 10, order.by = "freq", query.legend = "bottom", cutoff =0, set_size.show = TRUE, mainbar.y.label = "Intersection sizes", sets.x.label = "Sets" )
By degree:
upset(UpDown, nsets = 10, order.by = "degree", query.legend = "bottom", cutoff =0, set_size.show = TRUE, mainbar.y.label = "Intersection sizes", sets.x.label = "Sets" )
3.No grouping:
upset(UpDown, nsets = 10)
Thanks in advance for the reply!
Best,
IM
3 answers
The nintersects argument controls the number of intersections to be displayed, you can try changing that to show more than 40 (the default). As the manual states, if you set the argument to NA it will show all of them.
To fix the issue with margins I think you have to play with the attribute.plots parameter and theme(plot.margin = unit(c(...), "cm"))) (see examples in ?upset). I think @Papyrus is correct about nintersects (+1, why not making it an answer?)
The parameter set_size.scale_max functions as a workaround for the issue of left margin cutting the number of items in each set. I just set that parameter to a number high enough that the enlarged axis accomodates all the labels.
Log in to answer this question.