r - How to get an expression(cos (alpha)) into a labels? -
i'm trying label on arrow says:
||x|| cos (alpha)
but can't seem create work.
i can write ||x||
without problems, , cos (alpha) without problems, don't know how them 1 statement.
any ideas?
here code:
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)
study help("plotmath")
, demo.
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))
r expression labels
No comments:
Post a Comment