-
Notifications
You must be signed in to change notification settings - Fork 0
/
Heat maps.Rmd
53 lines (39 loc) · 1.47 KB
/
Heat maps.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: "Heat map"
author: "Jeff Hoover"
date: "November 19, 2018"
output: bookdown::pdf_document2
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
warning = -1
library(ggplot2)
```
```{r}
#generate a random binary matrix
mat <- matrix(sample(c(0,1), 20*20, replace = TRUE), nrow = 20)
#heatmap with binary coloring pattern
random_heatmap <- heatmap(mat, scale = "none", Rowv = NA, Colv = NA,
col = c("black", "white"),
labRow = FALSE, labCol = FALSE,
main = "Random Binary Heatmap")
```
```{r}
#generate a random binary matrix
mat2 <- matrix(sample(c(0:5), 50*50, replace = TRUE), nrow = 50)
#heatmap with binary coloring pattern
random_heatmap2 <- heatmap(mat2, scale = "none", Rowv = NA, Colv = NA,
col = heat.colors(256, alpha = 1),
labRow = FALSE, labCol = FALSE,
main = "Randomly Generated Heatmap")
```
```{r}
#generate a random binary matrix
mat3 <- matrix(sample(c(0:10), 50*50, replace = TRUE), nrow = 50)
colfunc <- colorRampPalette(c("black", "white"))
#test of the colfunc
#plot(rep(1,10), col = colfunc(10), pch=19, cex = 3)
random_heatmap3 <- heatmap(mat3, scale = "none", Rowv = NA, Colv = NA,
col = colfunc(10), labRow = FALSE, labCol = FALSE,
main = "Randomly Generated Heatmap")
```