UpSetR graphs are not saving properly when I call f
. What is being saved to tmp.tiff
is a blank image file. If I debug into the function, then it saves properly.
f <- function(tmp){
tmp <- tmp %>%
fromList() %>%
upset()
tiff(filename = 'tmp.tiff')
tmp
dev.off()
}
list(a = c(1, 1, 2, 6), b = c(2, 2, 3, 7)) %>%
f()
I've saved the graph to a variable, called the tiff function for a file stream, called the graph variable and then dev.off()
. What am I missing here?
edit:
#Calling tiff before upset does not work either.
f <- function(tmp){
tiff(filename = 'tmp.tiff')
upset(fromList(tmp))
dev.off()
}
list(a = c(1, 1, 2, 6), b = c(2, 2, 3, 7)) %>%
f()
if this is still a problem, I think you can find a solution here:
https://github.com/hms-dbmi/UpSetR/issues/115#issuecomment-1416486255
It seems that you need to
print
the plot to be able to save it inside a function. I don't know why, just came across it after reading this question.