krassowski / complex-upset

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

Relocation of Intersection size number, Add exact number of set size on the set size bar plot, Remove the background from the set size bar plot. #205

Open Jihyunchun71 opened 3 days ago

Jihyunchun71 commented 3 days ago

Objective 1) Relocation of Intersection size number : In the generated figure, the intersection size number is located within the barplot only at the highest bar plot. I want all the numbers located at the top of the bar plots.

2) Add exact number of set size on the set size bar plot Just like the intersection size plot, I want the exact number of set size to appear in the set size, but even after many trials, I failed. Please help me with it.

3) Remove the background from the set size bar plot. I want to remove the stripe pattern and ticks behind the set size bar plot. I've removed the backgrounds in intersection size plot, but couldn't removed it in set size plot. I want the set size plot background to be just white.

Code

organs = c("Feces", "Muscle", "Serum")

upset( RP, organs, name = 'organs', stripes = upset_stripes( colors = c("grey95", "white"), geom = geom_segment(size = 20) ), sort_intersections_by = c('degree', 'cardinality'),

base_annotations = list( 'Intersection\nsize' = intersection_size( counts = TRUE, mapping = aes(fill = Direction) ) + scale_fill_manual( values = c("Up" = "#B2182B", "Down" = "#2166AC", "etc" = "#D9D9D9"), breaks = c("Up", "Down", "etc"), labels = c("Up", "Down", "etc") ) + theme( panel.grid = element_blank(), axis.line = element_line(),
axis.line.x = element_blank(),
axis.text.x = element_blank(),
axis.ticks.x = element_blank(), axis.ticks.y = element_line() ) ),

matrix = intersection_matrix( geom = geom_point(size = 4), # Adjust dot size segment = geom_segment(size = 1.3) # Adjust line thickness in intersection matrix ),

width_ratio = 0.2, mode = 'distinct' )

Screenshot or illustration

image

Context (required)

ComplexUpset version: 1.3.3

R version details ```R ```
R session information ```R ```
krassowski commented 3 days ago

@Jihyunchun71

  1. intersection_size has bar_number_threshold argument, I think you can set it to 0 to get what you want.
  2. Like this https://krassowski.github.io/complex-upset/articles/Examples_R.html#display-counts ?
  3. stripes='white'? See https://krassowski.github.io/complex-upset/articles/Examples_R.html#stripes