如何在 ggplot 文本中插入对数符号?
这些是我的尝试:
myLabel = c("log_a b","log{a}")
ggplot(
data=data.frame(x=0,y=0)
) + geom_point(
aes(x=x,y=y)
) + annotate(
'text',
x = 0, y = 0,
parse = TRUE,size=10,
label = myLabel[2]) # here
注:以上摘自this发布
最佳答案
你的意思是这样吗?
ggplot(data.frame(x = seq(1:10), y = seq(1:10), label = "log[10]"), aes(x, y, label = label)) +
geom_text(parse = T) +
annotate("text", x = 1, y = 5, label = "2^log[2]", parse = T)
参见this link获取 plotmath
中的数学表达式列表。
关于r - 将日志符号放入 ggplot2 文本中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48917340/