How to change labels in the Intersection Matrix in Complex Upset R?

622 views Asked by At

I'm using ComplexUpset in R and I would like to know if changing the labels of the intersection matrix is possible. I attempted using

upset(
themes=upset_modify_themes(
        list(
            'intersections_matrix'=scale_x_discrete("A"="label A", "B"="label B")))

and I got :

Scale for x is already present.
Adding another scale for x, which will replace the existing scale

How can I change the labels. The names of the columns isn't something I could describe in one word.

1

There are 1 answers

0
krassowski On

Use labeller argument of the ComplexUpset::upset() function:

library(ComplexUpset)
movies = as.data.frame(ggplot2movies::movies)
movies[movies$mpaa == '', 'mpaa'] = NA
movies = na.omit(movies)
genres = colnames(movies)[18:24]

upset(
    movies, genres,
    min_size=200,
    labeller=ggplot2::as_labeller(c(
        'Drama'='DRAMA LABEL',
        'Comedy'='COMEDY LABEL'
    ))
)

enter image description here