Skip to content
Snippets Groups Projects
Commit f6ecef08 authored by Hubble's avatar Hubble
Browse files

Automatically adjust heatmap size

parent eebc78c2
No related branches found
No related tags found
1 merge request!7Automatically adjust heatmap size
...@@ -45,6 +45,8 @@ pval_long[,cor_val:= signif(round(cor_long$value, 2), 2)] ...@@ -45,6 +45,8 @@ pval_long[,cor_val:= signif(round(cor_long$value, 2), 2)]
pval_long[,full_annot := str_trim(paste0(cor_val, "\n",pval_annote))] pval_long[,full_annot := str_trim(paste0(cor_val, "\n",pval_annote))]
pval_long$full_annot[pval_long$full_annot == "1"] <- "" pval_long$full_annot[pval_long$full_annot == "1"] <- ""
pval_long$full_annot[pval_long$full_annot == "NA"] <- ""
cor_long[, variable:=ordered(cor_long$variable, levels=order_trait)] cor_long[, variable:=ordered(cor_long$variable, levels=order_trait)]
cor_long[, V1:=ordered(cor_long$V1, levels=order_trait)] cor_long[, V1:=ordered(cor_long$V1, levels=order_trait)]
...@@ -65,7 +67,10 @@ pG = pG + theme(legend.key.size = unit(1, 'cm'), #change legend key size ...@@ -65,7 +67,10 @@ pG = pG + theme(legend.key.size = unit(1, 'cm'), #change legend key size
pG = pG + geom_text(data=pval_long, aes(x=V1,y=variable, label=full_annot), size=3.5) pG = pG + geom_text(data=pval_long, aes(x=V1,y=variable, label=full_annot), size=3.5)
png(paste("HeatMap_", strsplit(Args[6], split=".", fixed=T)[[1]][1],".png", sep=""),width = 20, height = 20, png_width <- max(length(trait_name$ID)*0.5, 10)
png_height <- max(length(trait_name$ID)*0.5, 10)
png(paste("HeatMap_", strsplit(Args[6], split=".", fixed=T)[[1]][1],".png", sep=""),width =png_width , height = png_height,
units = "in", units = "in",
res = 300, res = 300,
pointsize = 4) pointsize = 4)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment