Mar*_*tin 6 expression r labels
我正试图在箭头上看到一个标签,上面写着:
|| X || cos(alpha)
但我似乎无法使其发挥作用.
我可以||x||毫无问题地编写没有问题的cos(alpha),但我不知道如何将它们写成一个语句.
有任何想法吗?
这是我的代码:
library(plotrix)
library(shape)
xlim <- c(-2, 6)
ylim <- c(-2, 6)
plot(0, type = "n", xlim = xlim, ylim = ylim,asp=1)
Arrows(1,1,5,1)
boxed.labels(3,1,labels="||x|| cos (a)",border=NA,xpad=1,ypad=1)
Arrows(1,2,5,2)
boxed.labels(3,2,labels=expression(cos (alpha)),border=NA,xpad=1,ypad=1)
Run Code Online (Sandbox Code Playgroud)
学习help("plotmath")和演示.
plot(0, type = "n", xlim = xlim, ylim = ylim,asp=1)
text(2,1,labels=expression(group("||", x, "||") %.% cos(alpha)),adj=c(1.2,-1.5))
text(2,3,labels=expression(group("||", x, "||") ~ cos(alpha)),adj=c(1.2,-1.5))
Run Code Online (Sandbox Code Playgroud)

您还可以使用bquote:
plot(1, type = "n")
text(1, 1, bquote("||x||" ~ cos(alpha)))
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
226 次 |
| 最近记录: |