2

Is it possible to make an UpSet plot with a transparent background?

I have checked the documentation and there are no arguments related to the background colour.

I have also tried saving directly as a .pdf but only a small section of the plot actually becomes transparent (to the left of the y-label).

library(UpSetR)

movies = read.csv(system.file("extdata", "movies.csv", package = "UpSetR"), 
                  header = TRUE, sep = ";")

pdf("test.pdf", bg = "transparent")

upset(movies, order.by = "freq",
      text.scale = 2,
      point.size = 4)

dev.off()

The section which becomes transparent is shown in blue in the image attached, this is so you can see the section of the plot I am referring to.

Figure

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

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

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

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

other attached packages:
[1] UpSetR_1.4.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2       assertthat_0.2.1 crayon_1.3.4     dplyr_0.8.3     
 [5] plyr_1.8.4       R6_2.4.0         grid_3.6.1       gtable_0.3.0    
 [9] magrittr_1.5     scales_1.0.0     ggplot2_3.2.1    pillar_1.4.2    
[13] rlang_0.4.0      lazyeval_0.2.2   rstudioapi_0.10  labeling_0.3    
[17] tools_3.6.1      glue_1.3.1       purrr_0.3.2      munsell_0.5.0   
[21] compiler_3.6.1   pkgconfig_2.0.3  colorspace_1.4-1 tidyselect_0.2.5
[25] gridExtra_2.3    tibble_2.1.3 

Thanks.

Marco Sandri
  • 23,289
  • 7
  • 54
  • 58
Mooholl
  • 21
  • 4
  • [See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. That includes a sample of data, all necessary code, and a clear explanation of what you're trying to do and what hasn't worked. We don't have your data, so we can't run your code, and there's no output here, so the best anybody can do right now is guess – camille Sep 30 '19 at 16:08
  • Hi you might get better results with the alternate implementation of UpSet plots in the complex heatmap package (https://jokergoo.github.io/ComplexHeatmap-reference/book/upset-plot.html) because of the way UpSetR is implemented transparency would probably involve quite a lot of pfaffing about with grid graphics. – Richard J. Acton Sep 30 '19 at 16:13
  • Thank you for the tips Camille, I've updated the post :) I will also take a look at using the heat map package and post a solution if I get one, thanks Richard :) – Mooholl Oct 02 '19 at 08:03

0 Answers0