我希望在我的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)
Run Code Online (Sandbox Code Playgroud)
我希望在等号后面有一个新行,所以这应该给:
VaR_0.99 =
0.03311
and not
VaR_0.99 = 0.03311
Run Code Online (Sandbox Code Playgroud)
我尝试用线条,但它不起作用:
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)
Run Code Online (Sandbox Code Playgroud) 有没有办法获取文本字符串的控制字符,例如在plotmath表达式中"\n"进行newline评估,反之亦然.在下面的例子中,我想结合:
在阅读完这个问题之后,我可以通过替代来获得大部分内容,但newline不会对角色进行评估.现在我转圈圈,并用自己的困惑plotmath,parse,bquote和substitute.在plotmath 的帮助页面中,它说
与普通绘图不同,控制字符(例如\n)不会在plotmath中的字符串中解释.
这是否意味着它真的不可能?
lab = "some data"
form = "Exponential"
x = 1:10
y = x^2
plot( x , y , type = "b" )
title( main = substitute( paste( "Plot of " , phi , " of: " , lab , "\nFunctional form: " , form ) , list(lab = lab , form = form …Run Code Online (Sandbox Code Playgroud)