How to stop graphical device window cutting off edges of plot()?
I suggest you add an outer margin (oma
) to not clip the tick labels, and plot the axis-label with mtext
to get it closer than the default position.
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()
Admin
Updated on June 08, 2022Comments
-
Admin almost 2 years
I have a
mfrow=c(6,4)
plot and a special situation where I want each plot to bemar=c(1,1,1,1)
. This makes it such that thex-axis
and thexlab
of the bottom 4 graphs get chopped off (even when exporting to.eps
).How do I stop
R
doing this? I've tried doingpostscript("test.eps",height=N)
whereN
is some real number that's larger than the default. This makes a lot of white space in the top and bottom of the.eps
but thex-axis
is still cut off.So my question is; how do I get
plot()
to stop cutting off myx-axis
andxlab
given the constraint that I want themfrow
andmar
described above? (I'm looking perhaps for some way to make the bottom of the device bigger such that the stuff I want isn't chopped off?).Here's my plots:
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()