krassowski / complex-upset

A library for creating complex UpSet plots with ggplot2 geoms
MIT License
469 stars 28 forks source link

Removed rows due to "missing values" when there are non #169

Open bagcik1lumc opened 1 year ago

bagcik1lumc commented 1 year ago

Why do I get the error message:

Removed 58539 rows containing missing values (position_stack()).

When the matrix looks like this:

image

Hence, there are no missing values.

krassowski commented 1 year ago

Please fill in the issue template in full and provide a reproducible example.

bagcik1lumc commented 1 year ago
{
  library(ggplot2)
  library(ComplexUpset)
}

set_size(8, 3)

upset(
  M1_BinaryMatrix,
  colnames(M1_BinaryMatrix),
  min_degree = 2,
  base_annotations = list(
    'Intersection ratio'=intersection_ratio(text_mapping=aes(label=!!upset_text_percentage()))
    + 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 = "distinct",
  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 = "")