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

geom_segment has outline sometimes #113

Closed
BastiDucreux opened this issue Apr 9, 2021 · 2 comments · Fixed by #119
Closed

geom_segment has outline sometimes #113

BastiDucreux opened this issue Apr 9, 2021 · 2 comments · Fixed by #119
Labels
help-request User requested help with the package

Comments

@BastiDucreux
Copy link

Objective
Hi, thank you very much for continuous improvements of your package, I really appreciate it. I am currently experiencing what seems a bug in ggplot2 or maybe I am missing something : on my plot the segments between sets on the intersection matrix sometimes display a black outline and I don't know why. Do you have any idea on how to make this clearer ?
Code

upset(
  movies,
  genres,
  min_size=10,
  width_ratio=0.2,
  matrix=(
    intersection_matrix(
      geom=geom_point(
        shape='circle',
        size=3.5
      ),
      segment=geom_segment(
        linetype='solid',size=1.5,
      ),
      outline_color=list(
        active='grey',
        inactive='white'
      )
    )
    + scale_color_manual(
      values=c('TRUE'='grey', 'FALSE'='white','yes'='#DBDEF8',
               'no'='#DEF8DB',
               'on weekends'='#F8DBDE'),
      labels=c('TRUE'='yes', 'FALSE'='no'),
      breaks=c('TRUE', 'FALSE'),
      name='Is intersection member?'
    )),
  queries=list(
    upset_query(intersect=c('Drama','Comedy'), color='grey',fill='grey'),
    upset_query(intersect=c('Drama','Action'), color='grey',fill='grey'),
    upset_query(intersect=c('Romance','Comedy'), color='grey',fill='grey'),
    upset_query(intersect=c('Drama','Romance'), color='grey',fill='grey'),
    upset_query(intersect=c('Drama','Comedy','Romance'), color='grey',fill='grey'),
    upset_query(intersect=c('Action','Comedy'), color='grey',fill='grey'),
    upset_query(intersect=c('Animation','Comedy'), color='grey',fill='grey')
  )
)

Screenshot or illustration

image

Context (required)

ComplexUpset version: ‘1.2.0’

R version details
$platform
[1] "x86_64-apple-darwin17.0"

$arch
[1] "x86_64"

$os
[1] "darwin17.0"

$system
[1] "x86_64, darwin17.0"

$status
[1] ""

$major
[1] "4"

$minor
[1] "0.4"

$year
[1] "2021"

$month
[1] "02"

$day
[1] "15"

$`svn rev`
[1] "80002"

$language
[1] "R"

$version.string
[1] "R version 4.0.4 (2021-02-15)"

$nickname
[1] "Lost Library Book"```

</details>


<details>
<summary>R session information</summary>

```R
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] psych_2.1.3                 gtools_3.8.2                ggplot2_3.3.3               ComplexUpset_1.2.0         
 [5] UpSetR_1.4.0                minfi_1.36.0                bumphunter_1.32.0           locfit_1.5-9.4             
 [9] iterators_1.0.13            foreach_1.5.1               Biostrings_2.58.0           XVector_0.30.0             
[13] SummarizedExperiment_1.20.0 Biobase_2.50.0              MatrixGenerics_1.2.1        matrixStats_0.58.0         
[17] GenomicRanges_1.42.0        GenomeInfoDb_1.26.5         IRanges_2.24.1              S4Vectors_0.28.1           
[21] BiocGenerics_0.36.0        

loaded via a namespace (and not attached):
  [1] colorspace_2.0-0          ellipsis_0.3.1            siggenes_1.64.0           mclust_5.4.7             
  [5] base64_2.0                rstudioapi_0.13           farver_2.1.0              bit64_4.0.5              
  [9] AnnotationDbi_1.52.0      fansi_0.4.2               xml2_1.3.2                codetools_0.2-18         
 [13] splines_4.0.4             sparseMatrixStats_1.2.1   mnormt_2.0.2              cachem_1.0.4             
 [17] scrime_1.3.5              Rsamtools_2.6.0           annotate_1.68.0           dbplyr_2.1.1             
 [21] HDF5Array_1.18.1          readr_1.4.0               compiler_4.0.4            httr_1.4.2               
 [25] assertthat_0.2.1          Matrix_1.3-2              fastmap_1.1.0             limma_3.46.0             
 [29] cli_2.4.0                 prettyunits_1.1.1         tools_4.0.4               gtable_0.3.0             
 [33] glue_1.4.2                GenomeInfoDbData_1.2.4    dplyr_1.0.5               rappdirs_0.3.3           
 [37] doRNG_1.8.2               tinytex_0.31              Rcpp_1.0.6                vctrs_0.3.7              
 [41] rhdf5filters_1.2.0        multtest_2.46.0           preprocessCore_1.52.1     nlme_3.1-152             
 [45] rtracklayer_1.50.0        DelayedMatrixStats_1.12.3 xfun_0.22                 stringr_1.4.0            
 [49] lifecycle_1.0.0           rngtools_1.5              XML_3.99-0.6              beanplot_1.2             
 [53] zlibbioc_1.36.0           MASS_7.3-53.1             scales_1.1.1              hms_1.0.0                
 [57] rhdf5_2.34.0              GEOquery_2.58.0           RColorBrewer_1.1-2        curl_4.3                 
 [61] gridExtra_2.3             memoise_2.0.0             ggplot2movies_0.0.1       biomaRt_2.46.3           
 [65] reshape_0.8.8             stringi_1.5.3             RSQLite_2.2.5             genefilter_1.72.1        
 [69] GenomicFeatures_1.42.3    BiocParallel_1.24.1       rlang_0.4.10              pkgconfig_2.0.3          
 [73] bitops_1.0-6              nor1mix_1.3-0             lattice_0.20-41           purrr_0.3.4              
 [77] Rhdf5lib_1.12.1           labeling_0.4.2            patchwork_1.1.1           GenomicAlignments_1.26.0 
 [81] bit_4.0.4                 tidyselect_1.1.0          plyr_1.8.6                magrittr_2.0.1           
 [85] R6_2.5.0                  generics_0.1.0            DelayedArray_0.16.3       DBI_1.1.1                
 [89] withr_2.4.1               pillar_1.5.1              survival_3.2-10           RCurl_1.98-1.3           
 [93] tibble_3.1.0              crayon_1.4.1              utf8_1.2.1                tmvnsim_1.0-2            
 [97] BiocFileCache_1.14.0      progress_1.2.2            grid_4.0.4                data.table_1.14.0        
[101] blob_1.2.1                digest_0.6.27             xtable_1.8-4              tidyr_1.1.3              
[105] illuminaio_0.32.0         openssl_1.4.3             munsell_0.5.0             askpass_1.1              
[109] quadprog_1.5-8           ```

</details>
@BastiDucreux BastiDucreux added the help-request User requested help with the package label Apr 9, 2021
@krassowski
Copy link
Owner

It's seems it is not a bug in ggplot2 itself but an imprecision of the renderer. If I remember correctly, the queries are implemented as an overlay (they are painted over the normal geoms, rather than instead). Normally two objects with the same dimensions, painted at the same coordinates should cover themselves fully, but it seems the renderer does not do that perfectly.

A workaround that might or you would be to add lineend='round'. Not sure why, but this fixes the problem for my renderer. Your experience might differ:

    segment=geom_segment(
        linetype='solid', size=1.5,
        lineend='round'
      ),

@krassowski
Copy link
Owner

krassowski commented May 1, 2021

Hi @BastiDucreux, the things should work better in the latest development version. The outline will remain but the point highlights are now rendered on top of the connectors which prevents the outline from causing the distracting visual effect. After upgrading to the development version:

if(!require(devtools)) install.packages("devtools")
devtools::install_github("krassowski/complex-upset")

You should see something comparable to this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-request User requested help with the package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants