【发布时间】:2021-02-20 06:57:23
【问题描述】:
我想将ggplot中注释的第二行中的单个字符斜体
剧情是这样的
iris %>%
ggplot(aes(x = Sepal.Length,
y = Species,
fill = Species)) +
stat_summary(geom = "bar", fun = "mean") +
theme(legend.position = "none") -> p
现在我可以像这样对情节进行注释,并让单个字符斜体,而其余字符则为单斜体。
p + annotate("text",
label = "italic(N)==74",
x = 3,
y = 2,
parse = T)
现在说我想要一个粘贴了某些字符的两行注释。我可以这样做不使用 plotmath
p + annotate("text",
label = paste("AUC = ",
round(60.1876,3),
"\nN = ",
74,
sep = ""),
x = 3,
y = 2,
size = 4)
如您所见,N 字符是单体的。有没有办法让它看起来像第二张图,但 N 斜体,无论是使用 plotmath 还是其他一些技术?
【问题讨论】: