如何解决如何在使用 ggplot2 制作的绘图的注释元素中一起使用 unicode 字符和希腊字母?
我想用annotate写1
library(ggplot2)
# Only greek letters
ggplot() +
annotate(geom = "text",label = "1*alpha*beta*t",parse = TRUE,x = 0,y = 0)
# Greek letters + unicode
ggplot() +
annotate(geom = "text",label = "1* \U226A *alpha*beta*t",y = 0)
Error in parse(text = text[[i]]) : <text>:1:4: unexpected input
1: 1* «
^
解决方法
ggplot() +
annotate(geom = "text",label = as.character(expression(paste("1 << ",alpha,beta))),parse = TRUE,x = 0,y = 0)
ggplot() +
annotate(geom = "text",label = as.character(expression(paste("1","\U226A",size = 5,y = 0)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。