Mercurial > repos > greg > ideas
comparison create_heatmap.R @ 114:c89bf5bf4661 draft
Uploaded
author | greg |
---|---|
date | Fri, 17 Nov 2017 09:41:07 -0500 |
parents | 14659ab1e709 |
children | f8a7bf4ca1a7 |
comparison
equal
deleted
inserted
replaced
113:ba7238a53377 | 114:c89bf5bf4661 |
---|---|
14 create_heatmap<-function(data_matrix, statecolor=NULL, markcolor=NULL, cols=c("white","dark blue")) { | 14 create_heatmap<-function(data_matrix, statecolor=NULL, markcolor=NULL, cols=c("white","dark blue")) { |
15 k = dim(data_matrix)[2]; | 15 k = dim(data_matrix)[2]; |
16 l = dim(data_matrix)[1]; | 16 l = dim(data_matrix)[1]; |
17 p = (sqrt(9 + 8 * (k - 1)) - 3) / 2; | 17 p = (sqrt(9 + 8 * (k - 1)) - 3) / 2; |
18 m = as.matrix(data_matrix[,1+1:p]/data_matrix[,1]); | 18 m = as.matrix(data_matrix[,1+1:p]/data_matrix[,1]); |
19 colnames(m) = colnames(data_matrix)[1+1:p]; | |
19 marks = colnames(m); | 20 marks = colnames(m); |
20 rownames(m) = paste(1:l-1," (", round(data_matrix[,1] / sum(data_matrix[,1]) * 10000) / 100, "%)", sep=""); | 21 rownames(m) = paste(1:l-1," (", round(data_matrix[,1] / sum(data_matrix[,1]) * 10000) / 100, "%)", sep=""); |
21 pdf(file=opt$output); | 22 pdf(file=opt$output); |
22 par(mar=c(6,1,1,6)); | 23 par(mar=c(6,1,1,6)); |
23 rg = range(m); | 24 rg = range(m); |