Answers.Body: <p><em>Answer from @haci, converted from comment:</em></p>
  <p>You can use the <code>pch</code> parameter in <code>anno_simple()</code> but you can only use a single character or a digit. It is not limited to symbols only,  you can provide a vector to <code>pch</code>, but only the first character would be printed. If by chance your values are [0-9] you can use <code>pch</code> as kind of hack for your purposes above.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-14T11:45:52.277Z
Answers.LastActivityDate: 2021-07-14T11:45:52.277Z
Answers.UserDisplayName: gringer
Body: <p>I am trying to use ComplexHeatmap to plot heatmap with annotation. 
  The code that I  have tried </p>
  
  <pre><code>library(ComplexHeatmap)
  library(circlize)
  
  set.seed(123)
  mat = matrix(rnorm(25), 5)
  rownames(mat) = paste0("R", 1:5)
  colnames(mat) = paste0("C", 1:5)
  
  col_fun = colorRamp2(c(0, 2, 5), c("white", "blue", "red"))
  data_foo = c(0.1, 3, 1.6, 2.8, 4)
  
  ha = HeatmapAnnotation(which = "row", foo = data_foo, col = list(foo = col_fun))
  Heatmap(mat, name = "mat", right_annotation = ha)
  
  ha1 = HeatmapAnnotation(which = "row", foo = anno_text(data_foo))
  Heatmap(mat, name = "mat", right_annotation = ha1)
  
  </code></pre>
  
  <p>Can I obtain the annotation with colors varying as per the annotation values and also display the values in the annotation? i.e is it possible to combine the annotation in both figures?
  <a href="https://i.sstatic.net/y1DSx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/y1DSx.png" alt="HeatMap with color annotation"></a></p>
  
  <p><a href="https://i.sstatic.net/0qBYQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0qBYQ.png" alt="HeatMap with values as annotation"></a></p>
  
Tags: <r><heatmap>
Title: Heatmap annotation with value and colour gradient
ThreadText: # Heatmap annotation with value and colour gradient
  
  (Asked by: username_0 on 2020-01-15)
  
  I am trying to use ComplexHeatmap to plot heatmap with annotation.
  The code that I have tried
  
  ```
  library(ComplexHeatmap)
  library(circlize)
  
  set.seed(123)
  mat = matrix(rnorm(25), 5)
  rownames(mat) = paste0("R", 1:5)
  colnames(mat) = paste0("C", 1:5)
  
  col_fun = colorRamp2(c(0, 2, 5), c("white", "blue", "red"))
  data_foo = c(0.1, 3, 1.6, 2.8, 4)
  
  ha = HeatmapAnnotation(which = "row", foo = data_foo, col = list(foo = col_fun))
  Heatmap(mat, name = "mat", right_annotation = ha)
  
  ha1 = HeatmapAnnotation(which = "row", foo = anno_text(data_foo))
  Heatmap(mat, name = "mat", right_annotation = ha1)
  
  ```
  
  Can I obtain the annotation with colors varying as per the annotation values and also display the values in the annotation? i.e is it possible to combine the annotation in both figures?
  [![HeatMap with color annotation](https://i.sstatic.net/y1DSx.png)](https://i.sstatic.net/y1DSx.png)
  
  [![HeatMap with values as annotation](https://i.sstatic.net/0qBYQ.png)](https://i.sstatic.net/0qBYQ.png)
  
  **Tags:** r, heatmap
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-14. Score: 0
  
  *Answer from @haci, converted from comment:*
  
  You can use the `pch` parameter in `anno_simple()` but you can only use a single character or a digit. It is not limited to symbols only, you can provide a vector to `pch`, but only the first character would be printed. If by chance your values are [0-9] you can use `pch` as kind of hack for your purposes above.
  
  
  ---
  
  