Different order for 'yaxis' labels in UpSetR or ComplexUpset package

Hi,

is there a solution how to order 'yaxis' items in a upset plot (regardless whether in UpSetR or ComplexUpset package) other than based on frequency of the item in the dataset? Using an this example from ComplexUpset library, is there a way how to order items other than in the predifined order (starting with 'Drama', 'Comedy' and ending in 'Short') based on a user-defined vector or a list?

Thanks!

You can disable the sorting of sets (see example 8.2 sorting sets) which will command the plot to preserve the order as specified in the second argument (intersect). For example, given genres = c('Action', 'Animation', 'Comedy', 'Drama', 'Documentary', 'Romance', 'Short') and using the following code:

upset(movies, rev(genres), width_ratio=0.1, min_size=100, sort_sets=FALSE)

you get:

Please note the use of rev() to reverse the vector.

1 Like

Thanks Michal! It was there after all. Great package, a bit overwhelming at times, tho :).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.