我有一个ggplot,其中我在标签文本中使用了expression(phantom(x) >=80)
以获得正确的大于或等于符号。
然而,我还需要在下方立即添加(N=...):
require(ggplot2)
.d <- data.frame(a = letters[1:6], y = 1:6)
labs <- c("0-9\n(N=10)","10-29\n(N=10)","30-49\n(N=10)", +
"50-64\n(N=10)","65-79\n(N=10)", expression(phantom(x) >=80))
ggplot(.d, aes(x=a,y=y)) + geom_point() +
scale_x_discrete(labels = labs)
如何将expression()
与转义字符\n
结合使用?