问题描述
我想用斜体表示A,而正常用CBS。 我认为ggtext可能有用,但出现错误。 这是一个例子:
func buttonTapped(sender: Any){
// show dialog.
MyBiometryUtility.sharedInstance().tryBiometryAuth()
}
func timerCountDown(){
// close dialog.
if tooLong() {
MyBiometryUtility.sharedInstance().closeBiometryAuth()
}
}
我也尝试过
tree<-read.tree(text="(A,(B,C));")
labs=c("*A*CBS","B","C")
tree$tip.label<-labs
ggtree(tree)+ geom_tiplab(align=T) + geom_richtext()
error: geom_rich_text requires the following missing aesthetics: label
但是我需要的富文本位于三个提示标签中,而不是全部五个标签(提示和节点)中 有谁知道如何添加标签的美感(作为小费标签)?
解决方法
您可以结合使用parse = T
参数和mathematical annotation:
library(ggtree)
library(ggtext)
tree<-read.tree(text="(A,(B,C));")
labs=c("paste(italic('A'),'CBS')","B","C")
tree$tip.label<-labs
ggtree(tree)+ geom_tiplab(align=T,parse=T)