UpsetR - How to display all possible intersections? How to change margins of upset plot legends?
3
2
Entering edit mode
4.4 years ago

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.

  1. 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" )

  2. 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

R upsetplot UpSetR margin vizualization • 9.1k views
ADD COMMENT
4
Entering edit mode
4.4 years ago
Papyrus ★ 3.0k

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.

ADD COMMENT
0
Entering edit mode
4.4 years ago

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?)

ADD COMMENT
0
Entering edit mode

Ok, moved it to answer!

ADD REPLY
0
Entering edit mode
2.1 years ago
JorgeVallejo ▴ 20

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.

Source:
https://github.com/hms-dbmi/UpSetR/issues/125

ADD COMMENT

Login before adding your answer.

Traffic: 1366 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6