Reputation: 143
When using matplot()
there always is a lot of empty space on the panel.
Normaly I cut it out with an external program, but it becomes a problem when arranging multiple graphs in one panel.
The option plot(x,y,...,,xaxs="i",yaxs="i")
removes space around the x-axis (plot becomes wider), but not for the y-axis. I have also tried to readjust the layout matrix, giving more or less rows in the matrix to plots.
I first arrange my plots with layout()
(works the same for par(mfrow=c(#,#))
). Then I add the plots.
layout(rbind(
c(1,1,2,2),
c(1,1,2,2),
c(3,3,4,4),
c(3,3,4,4),
c(5,6,7,8),
c(9,10,11,12)
))
matplot(matrix(runif(100),nrow=10),type='l',xaxs="i",yaxs="i") # plot 1 upper left
matplot(matrix(runif(100),nrow=10),type='l',xaxs="i",yaxs="i") # plot 2 upper right
# fill the other panels
for(i in 3:12){
plot(1:10,runif(10),type='p',xaxs="i",yaxs="i")
}
When plotting this, a lot of the panel is wasted with empty space, while the plots are cropped. I want panel space to be filled with (nice) plots, making them as large as possible.
Upvotes: 0
Views: 113
Reputation: 2141
?par
, entry mar
is your friend.
with par(mar=c(bottom,left,top,right))
you can set the margins around your plot to move them closer to each other
Upvotes: 1