在情节的标题中连接字符串和表达式 [英] Concatenate strings and expressions in a plot's title
问题描述
如何在情节的标题中组合文本和数学表达式。如果我使用粘贴表达式转换为字符。例如,我想要这样的东西作为标题
$ ARL_1 $ curve $ S ^ 2 $
谢谢
你想阅读?plotmath
做这样的事情这是一个例子:
plot(1:10,main = expression(ARL [1]〜curve for〜S ^ 2))
[。]
是下标,而 ^
给出上标。
编辑
strong>:通常我会做的: plot(1:10,main = expression(ARL [1]〜curve〜对于〜S ^ 2))
但是会导致错误,因为 / code>被解释为()
循环调用的的开始。
How can I combine text and math expressions in a plot's title. If I use paste the expression is converted to character. For example I want something like this as a title
$ARL_1$ curve for $S^2$
Thank you
You want to read ?plotmath
to see how to do this sort of thing. Here is an example:
plot(1:10, main = expression(ARL[1] ~ "curve for" ~ S^2))
The [.]
is subscript, whilst ^
gives superscript. The ~
spaces out the parts of the expression as if there were literal spaces.
Edit: normally I would have done:
plot(1:10, main = expression(ARL[1] ~ curve ~ for ~ S^2))
but that throws an error because for
is being interpreted as the start of a for()
loop call.
这篇关于在情节的标题中连接字符串和表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!