colors = structure(circlize::rand_color(4), names = c("a", "b", "c", "d"))
discrete_mat = matrix(sample(letters[1:4], 100, replace = TRUE), 10, 10)
cell_fun = function(j, i, x, y, width, height, fill) {
grid.rect(x = x *0.6, y = y, width = width * 0.6, height = height,
gp = gpar(col = "grey", fill = fill))
}
cell_fun4 = function(j, i, x, y, width, height, fill) {
s = min(unit.c(convertWidth(width, "cm"), convertHeight(height, "cm")))
grid.rect(x = x*0.6 , y = y, width = s* 0.6, height = height,
gp = gpar(col = "grey", fill = fill))
}
## always square.
cell_fun2 = function(j, i, x, y, width, height, fill) {
s = min(unit.c(convertWidth(width, "cm"), convertHeight(height, "cm")))
grid.rect(x = x*0.8, y = y*0.8, width = s * 0.8, height = s*0.8,
gp = gpar(col = "grey", fill = fill))
}
cell_fun3 = function(j, i, x, y, width, height, fill) {
grid.rect(x = x*0.8, y = y, width = width * 0.8, height = height,
gp = gpar(col = "grey", fill = fill))
}
Heatmap(mat_letters, rect_gp = gpar(type = "none"), cell_fun = cell_fun3, col = 1:4)
Heatmap(mat_letters, rect_gp = gpar(type = "none"), cell_fun = cell_fun2, col = 1:4)
Heatmap(mat_letters, rect_gp = gpar(type = "none"), cell_fun = cell_fun, col = 1:4)
Heatmap(mat_letters, rect_gp = gpar(type = "none"), cell_fun = cell_fun4, col = 1:4, show_heatmap_legend = FALSE)
Created
January 9, 2017 23:03
-
-
Save crazyhottommy/ec478496d85691e4d38e8ce7a94f1545 to your computer and use it in GitHub Desktop.
character_df_to_heatmap
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment