PharmGirl
PharmGirl

Reputation: 61

UpsetR: add numeric labels to set size on plot

Is there any way to add labels on top of the set size bars in UpsetR similar to the show.numbers for the main intersection graph?

test <- upset(grouped_hot,
              sets                = c("A", "B", "C", "N"),
              nintersects         = 8,
              mb.ratio            = c(0.6, 0.4),
              sets.x.label        = "Number of Patients",
              sets.bar.color      =  "#56B4E9",
              mainbar.y.label     = "Number of Patients",
              order.by            = "freq",
              empty.intersections = "on",
              keep.order          = FALSE,
              scale.sets          = "identity",
              att.pos             = "top",
              text.scale          = c(2.5, 2.5, 2, 1.5, 2.5, 2.5))

Expected result is to have labels over each of the set size bars stating the size.

Upvotes: 3

Views: 2083

Answers (1)

Ana
Ana

Reputation: 97

it is possible to do that with set_size.show:

test <- upset(grouped_hot, sets= c("A", "B", "C", "N"), 
        nintersects = 8, 
        mb.ratio = c(0.6, 0.4), 
        ...
        att.pos = "top", 
        text.scale = c(2.5,2.5,2,1.5,2.5,2.5),
        set_size.show = TRUE)

However, the current package version on Cran doesn't support this parameter, so you should work in the development mode (using devtools). The procedure is nicely written here: https://github.com/hms-dbmi/UpSetR/pull/104#issuecomment-376245215.

Make sure you load the package when already in the development mode. If you load it before, it loads the version from cran that is saved in your repository.

Best, Ana

Upvotes: 5

Related Questions