[R] plot function / par() settings

Pedro Mardones mardones.p at gmail.com
Tue Apr 8 19:47:39 CEST 2008


Dear all;

I'm trying to create a 2 x 3 plot (something I know like lattice can
do better) using the plot function. However; I'm not sure how to make
the width of the plots to be the same on each column. I guess the
answer maybe obvious but I haven't been able to figure it out. I'll
appreciate any suggestion. Here is the (highly inefficient) code for
the first row:


par(mfrow = c(2, 3))
par(omi = c(0.60, 0.60, 0.60, 0.10))

par(mai = c(0.00, 0.50, 0.50, 0.00))
plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", col = "blue");
axis(3, at = seq(1:5), labels = rep("", 5))

par(mai = c(0.00, 0.00, 0.50, 0.00))
plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
"red"); axis(3, at = seq(1:5), labels = seq(1:5))

par(mai = c(0.00, 0.00, 0.50, 0.50))
plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
"red"); axis(3, at = seq(1:5), labels = rep("", 5))
axis(4, at = seq(1:5), labels = rep("", 5))

Thanks
PM



More information about the R-help mailing list