Heatmaps
Given two matrices, this function plots heatmaps for each one with a fixed colour scale to allow for comparison.
1
2
3
4
5
6
7
8
9
10
11
12
13
heatmap_scale = function(matrix1, matrix2){
global_min <- min(matrix1, matrix2)
global_max <- max(matrix1, matrix2)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 299)
heatmap(matrix1, Colv = NA, Rowv = NA, scale = "none",
col = my_palette, breaks = seq(global_min, global_max, length.out = 300))
heatmap(matrix2, Colv = NA, Rowv = NA, scale = "none",
col = my_palette, breaks = seq(global_min, global_max, length.out = 300))
}