R:需要y标签是两行吗

R:需要y标签是两行吗,r,plot,label,expression,R,Plot,Label,Expression,我有一个y标签应该是这样的 “A.stutchburyi的丰富性 (#个人/0.50m^2)“其中#个人。。。。应该是第二行 问题是,我无法让它工作,因为我混合了不同的字体(普通和斜体)。通常我使用\n,但这在表达式中不起作用 这是我的代码,它只在一行上给出y标签: tsaplot <- barplot(tsa$No, beside = TRUE, xlab = "Size groups (mm)", ylab =

我有一个y标签应该是这样的 “A.stutchburyi的丰富性 (#个人/0.50m^2)“其中#个人。。。。应该是第二行

问题是,我无法让它工作,因为我混合了不同的字体(普通和斜体)。通常我使用\n,但这在表达式中不起作用

这是我的代码,它只在一行上给出y标签:

tsaplot <- barplot(tsa$No, beside = TRUE,
                   xlab = "Size groups (mm)",
                   ylab = expression(atop(paste("Abundance of",italic("A. stutchburyi"),"(# individuals / 0.50m^2)"))),
                   cex.axis = 1.4, density = 50, font.lab = 2, font.axis = 2, cex.lab = .9, col = "black",
                   names.arg = c("0-2.0","2.1-4.0","4.1-6.0","6.1-8.0","8.1-10.0","10.1-12.0","12.1-14.0","14.1-16.0","16.1-18.0","18.1-20.0",">20.1"),
                   ylim = c(0,100), xpd = FALSE)

tsaplot可能是括号错位:

tl <- bquote(atop(paste("Abundance of ",italic("A. stutchburyi")),"(# individuals / 0.50"*m^2 ~ ")"))

par(mar = c(5.1, 6.1, 4.1, 2.1))
plot(1, 1, t = "n", ylab = tl)
text(1, 1, tl)

我们需要
tsa
来获得一个可复制的示例。此外,R/RStudio和StackOverflow都不会对空格和换行符收取更多费用。无需使代码看起来像最小化的javascript。我尝试了您提供的代码,以及上面建议的代码,但这只将“#个人…”作为标签的第一部分…您确定没有混淆Jaap的答案吗?我的答案很有效。
par(mar = c(5.1, 6.1, 4.1, 2.1))
barplot(VADeaths, ylab = tl)