I am trying to have multiple histogram plots rendered from a for loop fill up the entire page on my R Markdown pdf output.
My histogram plots are rendered from the following code
mclogins<-c("sacfreq","logsacfreq","meanvel","logmeanvel", "meanvelx","logmeanvelx", "meanvely","logmeanvely","meanacc","logmeanacc", "meanaccx", "logmeanaccx", "meanaccy","logmeanaccy", "meanamp", "logmeanamp", "meanampx","logmeanampx", "meanampy","logmeanampy")
# dev.off()
par(mar=c(5.1 ,4.1, 4.1 ,2.1),mfrow=c(3,2))
for( i in mclogins){
hist(df.1log[,i],
xlab = i,
main = paste("Histogram of",i),
col = "lightblue")
}
Where df.1log
is the dataset containing values for all variables in mclogins
Right now, my output looks like this:
And as you can see, there is much empty space at the bottom of the page.
I have tried the following suggestions:
But it ends up causing the plots to disappear or nothing changes and the blank space is still there.
Thank you so much!