How to center an R plot

Posted by ConnorG on Stack Overflow See other posts from Stack Overflow or by ConnorG
Published on 2010-03-13T04:56:43Z Indexed on 2010/03/13 5:05 UTC
Read the original article Hit count: 339

Filed under:
|

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

The right hand margin is significantly smaller than the left.

© Stack Overflow or respective owner

Related posts about r

    Related posts about margin