Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change height of annotations #37

Closed
cristobalcar opened this issue Jun 12, 2020 · 2 comments
Closed

Change height of annotations #37

cristobalcar opened this issue Jun 12, 2020 · 2 comments
Labels
question Further information is requested

Comments

@cristobalcar
Copy link

Hi, I wanted to know how to change the height of this annotations:
code:


UPSETPLOT<-upset(TRATAMIENTO_ANTI_COVID_CON_VMI
                 ,TRATAMIENTO_ANTI_COVID_COLUMNAS
                 ,width_ratio=0.1
                 ,name='TERAPIAS ANTI COVID19'
                 ,stripes=c("white", "#B4D5DE")
                 ,min_degree=0
                 ,keep_empty_groups = TRUE
                 ,base_annotations=list(
                   'Intersection size'=intersection_size(text_aes=aes(label=paste0(round(intersection_size/union_size * 100), "%|",intersection_size,"")))
                 )
                 ,themes=upset_modify_themes(
                   list(
                     'intersections_matrix'=theme(text=element_text(size=15)),
                     'overall_sizes'=theme(axis.text.x=element_text(angle=90))
                   ))
                 ,annotations = list(
                   'ESTADIA\nHOSPITALARIA'=list(
                     aes=aes(x=intersection, y=LOS_DIAS),
                     geom=geom_boxplot()
                   ),
                   'LETALIDAD'=list(
                     aes=aes(x=intersection, fill=FALLECIDOS)
                     ,geom=list(
                       geom_bar(stat='count', position='fill')
                       ,scale_fill_manual(values=as.vector(c(GRIS,ROJO)))
                       ,scale_y_continuous(labels=scales::percent_format())))
                 ))

output:
Screen Shot 2020-06-12 at 13 49 55

I need to obtain something like this:
Screen Shot 2020-06-12 at 14 06 36

@krassowski
Copy link
Owner

Simply use + patchwork::plot_layout(heights=c(1, 0.2, 1)), e.g.:

upset(
    movies, genres, name='genre', width_ratio=0.1, min_size=100,
    annotations =list(
        'Intersection ratio'=intersection_ratio(
            text_aes=aes_(label=upset_text_percentage())
        ),
        'MPAA Raiting'=list(
            aes=aes(x=intersection, fill=mpaa),
            geom=list(
                geom_bar(stat='count', position='fill'),
                scale_y_continuous(labels=scales::percent_format())
            )
        )
    ),
    min_max_early=FALSE,
) + patchwork::plot_layout(heights=c(1, 0.2, 1, 1))

image

@krassowski krassowski added the question Further information is requested label Jun 12, 2020
@cristobalcar
Copy link
Author

Works great!
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants