My specific issue is evident when I output 3 plots to a html report using grid.arrange, sometimes the last plot (which is a tableGrob) is cropped.
I am using 3 separate grid.arrange()
statements to place a boxplot, a time series plot and a tableGrob in a html report using knitr.
Code being used to output is:
grid.arrange(p1,top=main)
grid.arrange(p2TS)
if(nrow(over5)>0){
tg=tableGrob(over5,theme=tt3,rows = NULL)
tg$widths = unit(rep(1/4, ncol(tg)), "npc")
grid.arrange(tg)
}
This displays perfectly when the tg object has less than roughly 10 rows of data.
However in testing larger datasets I found that the grid.arrange(tg)
outputs in a fixed height "window" in the report which is not desirable.
My question is how can I change the height of the grid.arrange(tg)
ouput to match the height of the tg object contained inside (with some top and bottom margin)??
I would appreciate understanding the mechanism by which these properties are changed so I can fine tune my output. I would have a 3x1 grid display all 3 outputs in one line of code if possible but all plots get condensed and unreadable so that is why I have 3 separate grid.arrange()
statements. I Guess my real issue is I don't understand how there properties are manipulated here.
Help is greatly appreciated.