I have a small question about expression when I use it in the pheatmap.
For example, I want to add information in the main title in a pheatmap plot with something in details. Here is my reproducible code:
# main <- expression(bold(paste(
# atop(CD4_CD69^"+",
# "\nReported human signature core methylation genes"~n[tiles]~" = 1999;
# "~n[genes]~"= 89")
# )))
main <- expression(bold(paste(
CD4_CD69^"+",
"\nReported human signature core methylation genes",
"\n", n[tiles], " = 1999;", n[genes], "= 89"
)))
test <- matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] <- test[1:10, seq(1, 10, 2)] + 3
test[11:20, seq(2, 10, 2)] <- test[11:20, seq(2, 10, 2)] + 2
test[15:20, seq(2, 10, 2)] <- test[15:20, seq(2, 10, 2)] + 4
colnames(test) <- paste("Test", 1:10, sep="")
rownames(test) <- c(paste("CGene", 6:10, sep=""),
paste("AGene", 1:5, sep=""),
paste("BGene", 11:15, sep=""),
paste("DGene", 16:20, sep=""))
library(pheatmap)
p1 <- pheatmap(test, main="pheatmap")
p2 <- pheatmap((test), cluster_row=FALSE,
main=expression(bold(paste(
atop(CD4_CD69^"+",
"Reported human signature core methylation genes"~n[tiles]~" = 1999;
"~n[genes]~"= 89")
))))
It works well though with a little bit error information.
But here, the main title information is long, so it seems that add two new lines to split the sentence into three lines is better.
However, as we all know, "\n" doesn't work in expression. Though I can remove expression
here.
But I don't know the other better methods to solve my problem.
I hope somebody or experts could give me some advice or solutions.
Thanks in advance.