Skip to content
Prev 139316 / 398503 Next

Problem with specifiying column widths in layout

The problem with your code is that you are passing widths to the matrix
function instead of the layout function.  The matrix function does not
know what you want to do with the "widths" and gives the error.  Move
that section to between the last 2 parentheses:
A possibly better approach would be to create an outer margin on the
left side and reduce the margins inside:
Then plot without the automatic axes and use the axis function with
outer=TRUE to place the axis.  Maybe something like:
+ plot( rnorm(10*i), rnorm(10*i), ann=FALSE, axes=FALSE, 
+ xlim=c(-3,3), ylim=c(-3,3) )
+ box()
+ if( i %% 3 == 1 ) axis(2, outer=TRUE)
+ if( i %/% 3 == 1 ) axis(1, outer=TRUE)
+ }


Hope this helps,