krassowski / complex-upset

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

Demo code does not show top Boxplots at all + Intersection values are also different f/your Demo Plot #160

Open sfd99 opened 2 years ago

sfd99 commented 2 years ago

Hi Mike,

Thanks for v 1.3.3 !. Great as always.

Prob: Ran your exact demo code shown at: https://krassowski.github.io/complex-upset/#showcase

1) but the "Length" Boxplots (at top), show as tight clusters of dots (not as Boxplots at all...). Its Y-axis scale, is also different from the demo image.

2) Also noticed in the "Intersection Size" barplot, that the total values I get for each combo, are different from those shown in your plot image, ie: you show 429, 263....

3) Other examples start w/ the line: set_size( .. , ..) but Rstudio reports: "unkown function".

Maybe something has changed in the in the input file: ggplot2movies::movies ?.

Or something else changed, or I am missing?.

Thanks for helping out, Mike!.

SFd99 SanFrancisco Ubuntu Linux 20.04 RStudio 2022.07.1 Build 554 (latest) R 4.2.1 ComplexUpset PKG v 1.3.3 (latest) ggplot2movies PKG 0.0.1 (latest) 27" and 19" Monitors. =====================

krassowski commented 2 years ago

(1) and (2): the dataset used to plot the image is filtered down as generating hundreds of images for documentation is time consuming; see https://krassowski.github.io/complex-upset/articles/Examples_R.html. The code below will reproduce it 1-1:

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

set.seed(0)   # keep the same jitter for identical plots

upset(
    movies,
    genres,
    annotations = list(
        'Length'=list(
            aes=aes(x=intersection, y=length),
            geom=list(
                geom_boxplot(),
                ylim(50, 250)
            )
        ),
        'Rating'=list(
            aes=aes(x=intersection, y=rating),
            geom=list(
                # if you do not want to install ggbeeswarm, you can use geom_jitter
                ggbeeswarm::geom_quasirandom(aes(color=log10(votes))),
                geom_violin(width=1.05, alpha=0.5)
            )
        )
    ),
    queries=list(
        upset_query(
            intersect=c('Drama', 'Comedy'),
            color='red',
            fill='red',
            only_components=c('intersections_matrix', 'Intersection size')
        ),
        upset_query(
            set='Drama',
            fill='blue'
        ),
        upset_query(
            intersect=c('Romance', 'Drama'),
            fill='yellow',
            only_components=c('Length')
        )
    ),
    min_size=15,
    width_ratio=0.15,
    height_ratio=0.75
)

(3) please read the documentation carefully:

Screenshot from 2022-09-04 19-12-34

krassowski commented 2 years ago

but the "Length" Boxplots (at top), show as tight clusters of dots (not as Boxplots at all...).

he boxplots are there, just so small that you cant see them (due to outliers).

sfd99 commented 2 years ago

Ah, understood. Thanks, Mike!.

ps: ref point 3),

I did read the documentation carefully but the only reason I did not define the set_size() function manually, (as you show in the image above, with the orange highlight), is that it says, above it: "...not relevant if you are using Rstudio...".

And I am using R in Rstudio. That's why I did not use that Fx definition for set_size().