Getting blank TIFF images using dev.off()

I am using the following code to make a heatmap of my dataset. I can see the heatmap in rstudio 'viewer'. But when I export the image as TIFF only a blank TIFF file created.

install.packages("heatmaply")
library(heatmaply)
abdel.data <- read.csv(file.choose())
row.names(abdel.data) <- paste0(abdel.data$Var)
abdel.heatmap.f <- abdel.data[,-1]

tiff(file="Heatmap_ploty.tiff",
width=3, height=5, units="in", res=600)
heatmaply(
percentize (abdel.heatmap.f),
dendrogram = c("row"),
color = colorRampPalette(c("green", "black", "red"))(100),
column_text_angle = 90,
k_row = 5,
scale = c("none"),
row_dend_left = FALSE,
grid_color = "black"
)
dev.off()

Hi @tahjib,
It seems that the heatmaply() function does not support TIFF output. You could use PNG and then convert to TIFF using the magick package. However, heatmaply() doesn't support increasing the resolution to 600 dpi, so the default may not be high enough for your purposes.
Might be better to use another method in R to create the heatmap (e.g. ggplot2) and thus retain full control of the output options.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.