gpt4 book ai didi

r - 在 r 中使用 bquote 摆脱自动间距

转载 作者:行者123 更新时间:2023-12-02 07:44:39 25 4
gpt4 key购买 nike

我正在尝试使用 bquote 函数在 r 中标记绘图 Axis 。所需的字符串包含希腊语 mu 字符和一个变量。

这会导致 mu 两侧出现空格:

xlab = bquote("Lake NO3 (" ~ mu ~ "mol/L): " ~ .(i))

如何去掉 mu 旁边的空格?

我尝试使用paste和paste0表达式,但是它们都不允许同时使用希腊字符和变量。

最佳答案

如果你想去掉mu两侧的空间

i <- 25
plot(1, xlab=bquote("Lake NO3 ("*mu*"mol/L): " ~.(i) ))

如果您需要右侧空间

plot(1, xlab=bquote("Lake NO3 ("*mu~ "mol/L): " ~.(i) ))

关于r - 在 r 中使用 bquote 摆脱自动间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26430994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com