gpt4 book ai didi

r - 如何在与 `bquote` 一起使用的 `text` 表达式中换行?

转载 作者:行者123 更新时间:2023-12-04 03:38:41 26 4
gpt4 key购买 nike

我想在我的 bquote 中有一个新行环境,我该怎么做?

我的代码:

test<-c(1,2,3,4,4.5,3.5,5.6)
test2<-0.033111111
plot(test,c(1:length(test)))

segments(4,0,4,23,col="red",lwd=2)
text(5, 4.5, labels = bquote(Qua[0.99] == .(round(test2,4))),col="red", cex = 1.4)

我想在等号之后有一个新行,所以这应该给出:
VaR_0.99 =

0.03311

and not

VaR_0.99 = 0.03311

我用线条试过了,但没有用:
    test<-c(1,2,3,4,4.5,3.5,5.6)
test2<-0.033111111
lines<-list(bquote(Qua[0.99] == ),bquote(.(round(test2,4))))
plot(test,c(1:length(test)))

segments(4,0,4,23,col="red",lwd=2)
text(5, 4.5, labels =lines ,col="red", cex = 1.4)

最佳答案

例如,使用 atop :

test<-c(1,2,3,4,4.5,3.5,5.6)
test2<-0.033111111
plot(test,c(1:length(test)))

segments(4,0,4,23,col="red",lwd=2)
text(5, 4.5,
labels = bquote(atop(Qua[0.99] == phantom(), .(round(test2,4)))),
col="red", cex = 1.4)

enter image description here

关于r - 如何在与 `bquote` 一起使用的 `text` 表达式中换行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15663535/

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