How to change the labelling of the intersection size and set size?

470 views Asked by At

How can I display the intersection size as percentage of total rows? How can I change the set size as percentage of total rows? The set size should display the marginals, i.e., the total TRUEs returned by one member (column)?

{
  library(ggplot2)
  library(ComplexUpset)
}

set_size(8, 3)

upset(
  head(M1_BinaryMatrix, 1000),
  colnames(M1_BinaryMatrix),
  base_annotations = list('Size'=(intersection_size(counts=TRUE, mode='inclusive_intersection'))
    + ylab("") 
    + theme(axis.text.y=element_blank())
    ),
  sort_intersections_by='ratio',
  name = "",
  annotations = list(), 
  themes = upset_themes,
  stripes=c(alpha('grey90', 0.45), alpha('white', 0.3)),
  labeller = identity,
  height_ratio = 0.5,
  width_ratio = 0.3,
  sort_sets='ascending',
  wrap = FALSE,
  set_sizes=(
    upset_set_size(position='right')
    + geom_text(aes(label=!!aes_percentage(relative_to='all')), hjust=1.1, stat='count', color='white')
    + ylab("")
    + theme(axis.text.x = element_blank())
  ),
  mode = "inclusive_intersection",
  queries = list(),
  guides = NULL,
  encode_sets = TRUE,
  matrix = intersection_matrix(    
    geom=geom_point(
    shape='square',
    size=4
  ),
  segment=geom_segment(
    linetype='solid'
  ), 
  outline_color=list(
    active='darkorange3',
    inactive='grey70'
  )
  ),
  n_intersections='all'
  ) +
  labs(title = "",
       caption = "")
0

There are 0 answers