How to stop the graphics device window by cutting off the edges of the graph ()?

I have a schedule mfrow=c(6,4)and a special situation when I want every schedule to be mar=c(1,1,1,1). This makes it so that x-axisand xlabthe lower 4 graphs chops off (even when you export to .eps).

How to stop Rdoing this? I tried to do postscript("test.eps",height=N)where N- this is some real number that is greater than the default value. This makes a lot of white space at the top and bottom .eps, but x-axisis still off.

So my question is; how do i get plot()to stop disconnecting mine x-axisand xlabtaking into account the restrictions that I want to describe above mfrowand mar? (I look, perhaps in some way, to make the bottom of the device larger so that the things I want are not chopped off?).

Here are my stories:

postscript("test.eps")
y <- rnorm(100)
x <- rnorm(100)

par(mfrow=c(6,4),mar=c(1,1,1,1))

for(i in 1:((6*4)))
{
    if(i <= (6*4)-4)
    {
    plot(y,x,xlab="",xaxt="n")
    }
    if(i > (6*4)-4)
    {
    plot(y,x,xlab="HELLO")
    }
}
dev.off()
+5
source share
1 answer

I suggest you add an outer edge ( oma) so as not to crop the tick marks, and draw an axis mark with using mtextto approximate it by default.

postscript("test.eps")
y <- rnorm(100)
x <- rnorm(100)

par(mfrow=c(6,4),mar=c(1,1,1,1), oma=c(3,1,0,0))

for(i in 1:((6*4)))
{
    if(i <= (6*4)-4)
    {
    plot(y,x,xlab="",xaxt="n")
    }
    if(i > (6*4)-4)
    {
    plot(y,x,xlab="")
    mtext("HELLO", 1, 2.5)
    }
}
dev.off()

enter image description here

+3
source

All Articles