删除轴标签后如何使 R 图居中
我正在研究 R 中的矩阵可视化(几乎与 http://reference. Wolfram.com/mathematica/ref/MatrixPlot.html),我一直用它
image(<matrix>,axes=FALSE)
来绘制图片。然而,我注意到,当 y 轴关闭时,绘图并不居中——轴刻度 + 标签的空间仍然存在。我可以欺骗一些居中,
par(oma=c(0,0,0,2.5))
但这似乎效率低下且容易出错(如果我的矩阵要改变尺寸/变得非正方形)。有没有更好的方法来强制图形居中? 参考图片 http://img694.imageshack.us/img694/9891/metropolis.png< /a>
右侧边距明显小于左侧。
I'm working on visualizing a matrix in R (almost exactly like http://reference.wolfram.com/mathematica/ref/MatrixPlot.html), and I've been using
image(<matrix>,axes=FALSE)
to draw the picture. However, I noticed that with the y-axis turned off, the plot isn't centered--the space is still there for the axis ticks + label. I can finagle some centering with
par(oma=c(0,0,0,2.5))
but this seems inefficient and error-prone (if my matrix were to change dimensions/become non-square). Is there a better way to force the graphic to center?
Reference image http://img694.imageshack.us/img694/9891/metropolis.png
The right hand margin is significantly smaller than the left.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有
帮助吗?
Does
help?