I have made a heatmap using the ComplexHeatmap package in R. I wanted to save the map on my pc and I run the following code:
df <- read.csv("/home/aahm/filename.csv")
View(df)
df1<- t(df[,2:ncol(df)])
colnames(df1) <- df[,1]
View (df1)
df2 <- scale(df1)
library(ComplexHeatmap)
library(RColorBrewer)
library(circlize)
mycols <- colorRamp2(breaks = c(0, 0.2, 0.4, 0.6, 1.0),
colors = c('white', "green", "red", "magenta", "blue"))
png(file="/home/aahm/Desktop/filename_heatmap.png")
Heatmap(df1, width = unit(15, "cm"),
name = "nucleotide diversity scores",
row_names_gp = gpar(fontsize = 7), column_title = "Nucleotide Positions", row_title = '1000 Genomes populations',
column_title_side = "bottom",
col = mycols,
show_column_dend = FALSE, cluster_rows = FALSE,
column_order = order(as.numeric(gsub("column", "", colnames(df1)))),
column_names_rot = 45,
)
dev.off()
An empty textfile with extension .png is created on my desktop rather than a png file with the map. Can someone help me find out what is wrong with my code?