如何在一行中使用多个表达式 [英] How to use more than one expression in a row
问题描述
)8< =(小于或等于)x< = 10 在我的情节标题中。
我尝试过这样的事情:
<$ c $ $ c
mtext(c(表达式(8≤x)),表达式(x <= 10) ,side = 3)
这不完全是我想要的,但是8(少于或等于)xx (少于或等于)10,这两个表达方式打印在主标题下方(这是很酷),但在同一个地方,这几乎没用:)
我还试过:
plot(1:10,main = bquote(paste(8& x,x = 10,sep =,)))
什么样的我想(除了分隔符似乎被完全忽略),但我不能添加更多的文本。输出:8(少于或等于)xx(小于或等于)10。
当我尝试
plot(1:10,main = paste(x)bquote(paste(x <= 8,z <= 10,sep =)) ))
输出完全激怒我:标题是:xpaste(\\\
) xx <= 8(\\\
)xz = 10(\\\
)x((\\\
)是换行符,其他字符正好是打印的)
所以有可能用多个操作符打印表达式?
plot(1:10,main =〜bold(atop(嘿,伙计们,这是我的情节,{ 8< = x}< =10)))
c $ c> windows()设备看起来像这样:
REVISED 间距,使第二行有点大,以匹配第一行。添加rbatt的顶部
想法。进一步简化。
I am new to R and I am trying to figure out, how to write something like "Hey guys, this is my plot for (\n)8 <=(less than or equal) x <= 10" in my plot-title.
I tried something like this:
plot(1:10, main="Hey, guys, this is my plot for \n")
mtext(c(expression(8 <= x),expression(x <= 10), side=3)
This gives not exactly what I want but "8 (less or equal) x x (less or equal) 10", and those two expressions are printed in a line below the main title, (which is pretty cool) but in the same place, which is pretty much useless :)
I also tried:
plot(1:10, main=bquote(paste(8 <= x, x <= 10, sep=",")))
What kind of does what I want (except the seperator seems to be completely ignored), but I cant add further text. Output: "8 (less or equal) xx (less or equal) 10".
And when I tried
plot(1:10, main=paste("x",bquote(paste(x <= 8,z <= 10,sep=" ")),sep=" "))
the output irritated me completely: the title was: "xpaste (\n) x x <= 8 (\n) x z <= 10 (\n) x" (the (\n) is a line break, the other characters are exactly what is printed)
So is there a possibility to print expressions with more than one operator?
Try this:
plot( 1:10, main = ~ bold(atop("Hey, guys, this is my plot for", {"8" <= x} <= "10")))
On the windows()
device it looks like this:
REVISED spacing and made 2nd line a bit larger to match first line. Added rbatt's atop
idea. Further simplification.
这篇关于如何在一行中使用多个表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!