简体   繁体   中英

How to print a matrix in an R plot?

..Not how to plot a matrix. I want to insert a 3x3 matrix into an R-plot, I don't see how to do this within plotmath() which mimics alot of latex commands. I would like to mimic the latex pmatrix environment style. This trick works for 2x2 matrices:

text(1,.4, expression(bgroup("(", atop("x 4 f", "y 3 5"), ")")))

Try something like this:

text(1,.4, expression(bgroup("(", atop("x 4 f", atop("y 3 5","z 2 k")), ")")))

You could also try an approach like this to have all the rows be the same size font:

text(1,.4, expression(bgroup("(", atop("\n",paste("x 4 f \ny 3 5 \nz 2 k")), ")")),cex=0.8)

or

text(1,.4, expression(bgroup("(", atop("\n",paste(" x 4 f \n y 3 5 \n z 2 k")), ")")),cex=0.8)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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