Hello, everyone
I have an issue when I'm trying to draw some lines and text in the output of pheatmap.
For example, I have the next heatmap from the matrix:
a <- matrix(rnorm(100), 10, 10)
pheatmap(a,
show_rownames = F,
border_color = NA,
scale = "row",
clustering_distance_rows = "euclidean",
clustering_distance_cols = "euclidean",
clustering_method = "single",
show_colnames = F,
main = "Something \n")
And then I'm using the next code to add the text:
grid.text("Group A" , x= 0.3, y = 0.01)
grid.text("Group B" , x= 0.75, y = 0.01)
Which prints the text over the heatmap. I need the text to be printed below the plot and then, add some separate lines above the text.
For adding the lines I employed grid.lines
. However, it drew me a continuous line.
Best regards
Try playing with
cell height
andwidth
and change the x and y coordinates of the text. Or you can read more about grid.graphics used by pheatmap.