简体   繁体   English

如何在R图中打印矩阵?

[英]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. 我想在R图中插入3x3矩阵,我看不到如何在模拟大量乳胶命令的plotmath()中执行此操作。 I would like to mimic the latex pmatrix environment style. 我想模仿乳胶的pmatrix环境风格。 This trick works for 2x2 matrices: 此技巧适用于2x2矩阵:

text(1,.4, expression(bgroup("(", atop("x 4 f", "y 3 5"), ")"))) 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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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