comparison create_heatmap.R @ 148:0ba72d5ca209 draft

Uploaded
author greg
date Thu, 11 Jan 2018 10:32:59 -0500
parents 387b460ddd43
children
comparison
equal deleted inserted replaced
147:387b460ddd43 148:0ba72d5ca209
35 } 35 }
36 36
37 create_heatmap <- function(data_frame, output_file_name, colors=c("white", "dark blue")) { 37 create_heatmap <- function(data_frame, output_file_name, colors=c("white", "dark blue")) {
38 # Plot a heatmap for a .para / .state combination based on the 38 # Plot a heatmap for a .para / .state combination based on the
39 # received data_frame which was created by reading the .para file. 39 # received data_frame which was created by reading the .para file.
40 num_columns = dim(data_frame)[2];
41 num_rows = dim(data_frame)[1];
42 p = (sqrt(9 + 8 * (num_columns-1)) - 3) / 2;
43 data_matrix = as.matrix(data_frame[,1+1:p] / data_frame[,1]);
40 state_colors_vector = get_state_color_codes_vector(data_frame, colors=colors, color_code_type="hex"); 44 state_colors_vector = get_state_color_codes_vector(data_frame, colors=colors, color_code_type="hex");
41 # Open the output PDF file. 45 # Open the output PDF file.
42 pdf(file=output_file_name); 46 pdf(file=output_file_name);
43 # rownames(data_matrix) are the state indexes, 47 # rownames(data_matrix) are the state indexes,
44 # and will look something like this: 48 # and will look something like this: