Skip to content
Prev 56566 / 398500 Next

pointsize in png graphics

Hi
Jan.Kleinn at partnerre.com wrote:
I think the problem is that R is trying to think for you.  R 
automatically reduces text size when there are more than three plots (or 
more than three cells in a layout) on a page.  Below are two suggestions 
for making the two layouts the same:


# dummy image plot
dummyplot <- function(col) {
   plot.new()
   usr <- par("usr")
   rect(usr[1], usr[3], usr[2], usr[4], col=col)
}

# original problem
x11()
layout(matrix(c(1, 2), ncol = 2, nrow = 1, byrow = T),
        widths = c(6, 1), heights = 1)
par(mar = c(0.2, 0.2, 0.2, 0.2), mgp = c(2, 1, 0), las = 0)
dummyplot("orange")
dummyplot("blue")

x11()
layout(matrix(c(1, 2, 5, 3, 4, 5), ncol = 3, nrow = 2, byrow = T),
        widths = c(3, 3, 1), heights = c(1, 1))
par(mar = c(0.2, 0.2, 0.2, 0.2), mgp = c(2, 1, 0), las = 0)
dummyplot("red")
dummyplot("yellow")
dummyplot("pink")
dummyplot("violet")
dummyplot("blue")

# solution 1: make second layout same as first
# leave first page alone
# revert auto cex decrease on second page
x11()
layout(matrix(c(1, 2), ncol = 2, nrow = 1, byrow = T),
        widths = c(6, 1), heights = 1)
par(mar = c(0.2, 0.2, 0.2, 0.2), mgp = c(2, 1, 0), las = 0)
dummyplot("orange")
dummyplot("blue")

x11()
layout(matrix(c(1, 2, 5, 3, 4, 5), ncol = 3, nrow = 2, byrow = T),
        widths = c(3, 3, 1), heights = c(1, 1))
par(mar = c(0.2, 0.2, 0.2, 0.2), mgp = c(2, 1, 0), las = 0,
     ### CHANGES HERE
     cex=1.5, mex=0.66)
dummyplot("red")
dummyplot("yellow")
dummyplot("pink")
dummyplot("violet")
dummyplot("blue")

# solution 2: make first layout same as second
# make same number of columns/rows in first layout
# leave second page alone
x11()
layout(### CHANGES HERE
        matrix(c(1, 1, 2, 1, 1, 2), ncol = 3, nrow = 2, byrow = T),
        widths = c(6, 1), heights = 1)
par(mar = c(0.2, 0.2, 0.2, 0.2), mgp = c(2, 1, 0), las = 0)
dummyplot("orange")
dummyplot("blue")

x11()
layout(matrix(c(1, 2, 5, 3, 4, 5), ncol = 3, nrow = 2, byrow = T),
        widths = c(3, 3, 1), heights = c(1, 1))
par(mar = c(0.2, 0.2, 0.2, 0.2), mgp = c(2, 1, 0), las = 0)
dummyplot("red")
dummyplot("yellow")
dummyplot("pink")
dummyplot("violet")
dummyplot("blue")

Paul