英文:
How to use plotmeth in pheatmap title?
问题
我想在pheatmap的标题中添加上标字符串,例如“+/-”。
我尝试了很多方法,但都没有成功。要同时添加特殊字符串如“+/-”有点困难。
英文:
I want to add superscript string,such as "+/-" in the tile in pheatmap.
I tried my best to come up with some ideas but it doesn't work.
Here is my reproducible code:
library(pheatmap)
main<- expression(ABC^'+/-')
pheatmap(matrix(runif(100,0,1),10,10),
main = main)
It can add only the single expression string in the title.
But I want to add other information with a blank line not only the expression information like this:
main<- paste(expression(ABC^'+/-'),"\nABCDEFG")
pheatmap(matrix(runif(100,0,1),10,10),
main = main)
It is a little bit difficult to me to solve it.
I hope somebody could help me deal with this problem.
Thanks in advance.
######## update:
I tried many methods. But it still doesn't work. It is a little difficult to add special string like "+/-"
together.
答案1
得分: 0
最后,我找到了一个更好但不是完美的方法:
这是我的解决方案:
pheatmap(mat,
main =expression(atop(ABC^'+/-'',
"ABCDEFG")))
只需使用"atop"
而不是"\n"
。因为"\n"
在表达式函数中不起作用。
我说这不是完美的,因为如果你想要paste/paste0
包含表达式的任何字符串,然后在它之后添加一些信息,可能不会表达得很清楚。
例如:
pheatmap(mat,
main =expression(atop(ABC^'+/-'',
paste("ABCDEFG,总数 = ",dim[mat][1],))))
这里paste()
不起作用,因为表达式()。
所以如果你是这个领域的专家,或者我可能忽略了一些详细信息,希望能给我一些建议或解决方案。
提前感谢。
英文:
Finally, I find a better but not perfect method:
Here is my solution:
pheatmap(mat,
main =expression(atop(ABC^'+/-',
"ABCDEFG"))
Just use "atop"
instead of "\n"
. Because "\n"
doesn't work in an expression function.
I said that it is not perfect because if you want to paste/paste0
any strings which contains with an expression and after it, some information may not express clearly.
For example:
pheatmap(mat,
main =expression(atop(ABC^'+/-',
paste("ABCDEFG,the total number = ",dim[mat][1],)))
Here the paste()
doesn't work because of expression().
So somebody could give me some advice or solution if you are expert in this region.
Or maybe I ignored some information in detail.
Thank in advance.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论