简体   繁体   English

使用R图中的结果值在图中用下标和上标标记一条线

[英]labelling with subscript and superscript a line in a plot using result values in R plot

I worked out some results and obtained a value (VALUE) with asymmetric errors (UERROR, and LERROR). 我计算出一些结果,并获得了具有非对称错误(UERROR和LERROR)的值(VALUE)。 I would like to have a label for a R plot using these values. 我想有一个使用这些值的R图的标签。 With symmetrical errors, I an easily get the expression for the label as follows label<-paste(VALUE,"±",ERRORS) For the asymmetric errors, I am not sure how to proceed to have have the +error as a superscript and the - error as a subscript. 对于对称错误,我很容易获得标签的表达式,如下所示: label<-paste(VALUE,"±",ERRORS)对于非对称错误,我不确定如何继续使+ error为上标,并且-错误作为下标。 I have tried label<-paste(VALUE[LERROR]^UERROR) but I get a label with "NA". 我已经尝试了label<-paste(VALUE[LERROR]^UERROR)但得到的标签带有“ NA”。 I would like to be complete to add a "+" and a "-" in front of the appropriate errors and complete the expression with the units "kg". 我想在适当的错误前面添加一个“ +”和一个“-”,并用单位“ kg”完成该表达式。 I am really a total novice at R but am sure this is possible having seen simultaneous subscripts and superscripts built with R but manually entered values. 我确实是R的一个新手,但是可以肯定的是,看到同时使用R生成的下标和上标但手动输入了值,这是可能的。 K^2[t] etc. Really intrigued as how to proceed. K ^ 2 [t]等。真正吸引人的是如何进行。 Thanks for helping! 感谢您的帮助!

Use bquote : 使用bquote

value <- 1
upr <- 1.2
lwr <- 0.5

plot.new()
text(0.5, 0.5, bquote(.(value)[.(lwr)]^.(upr)), cex = 10)

结果图

However, I wouldn't understand this notation without further explanation. 但是,如果没有进一步的说明,我将无法理解该表示法。

See also help("plotmath") for further advice regarding mathematical annotations in plots. 另请参阅help("plotmath")以获取有关绘图中数学注释的更多建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM