Skip to content

Same plot size with mfrow()

5 messages · Bert Gunter, Charlie Brown, David Winsemius

#
It is hard to know what to recommend, as you don't give us any context.

If the plots are interrelated in certain ways, lattice and ggplot both
provide conditioning plots.Check vignettes and documentation for these
packages.

For base graphics, ?layout may be what you want.

Cheers,
Bert

On Tue, Jul 9, 2013 at 3:23 PM, Charlie Brown
<charliethebrown77 at gmail.com> wrote:

  
    
#
On Jul 9, 2013, at 3:23 PM, Charlie Brown wrote:

            
Those omi values aRE TOO LARGE.
png("example.png", height=1000, width=1500)

par(mfrow=c(2, 2), cex=2, cex.lab=1.5, cex.axis=1.5, cex.main=2, mgp=c(3,
1, 0), omi=c(2,1,1, 1), pin=c(5,4) )  # attempting to force equal sized plot dimensions
plot(c(1:100), c(1:100), xaxt="n", ylab="Y-label 1")
plot(c(1:100), c(1:100), xaxt="n", yaxt="n", ylab="")
plot(c(1:100), c(1:100), xlab="X-label", ylab="Y-label 2")
plot(c(1:100), c(1:100), yaxt="n", xlab="X-label 2", ylab="")

dev.off()


Closer, but if you wnat control over the axis labeling to avoid the irregular gaps, you need to use the `axis` function.
David Winsemius
Alameda, CA, USA
#
On Jul 9, 2013, at 5:12 PM, David Winsemius wrote:

            
Another effort, using varying mar parameters.

png("example.png", height=1000, width=1500)
 par(mfrow=c(2, 2), cex=2, cex.lab=1.3, cex.axis=1.3, cex.main=2,
    omi=c(.5,.5,.5,.5), mar=c(4,4,0,.2), xpd=TRUE )
 plot(c(1:100), c(1:100), xaxt="n", ylab="Y-label 1", xlab="")
 plot(c(1:100), c(1:100), xaxt="n", yaxt="n", ylab="",xlab="");par(mar=c(4,4,0,0))
 plot(c(1:100), c(1:100), xlab="X-label", ylab="Y-label 2");par(mar=c(4,4,0,0))
 plot(c(1:100), c(1:100), yaxt="n", xlab="X-label 2", ylab="")
 dev.off()