I'm having an issue trying to use grid.arrange to arrange multiple plots in an RMarkdown document (output to html).
Without being able to post a replicable example of the plots themselves, here's the basic issue:
I can arrange two plots, side-by-side, reasonably well:
grid.arrange(
plot1,
plot2,
ncol=2,
top = "Title of the page"
)
Which looks like this:
But as soon as I try to add two more plots:
grid.arrange(
plot1,
plot2,
plot3,
ncol=2,
top = "Title of the page"
)
grid.arrange starts to squish the plots:
I've tried adding a heights
parameter to grid.arrange
, but no luck. Basically, I just want a reasonable looking arrangement of graphs that doesn't squish or distort them in the RMarkdown doc.
patchwork
grid.arrange
. It's the size of thegrid.arrange
object.html_document
defaults to some wicked margins. (You saidhtml
but there are many, many HTML options in RMD.) For the margin issue:<style>.main-container{max-width: unset;}</style>
. If you are usingflex_dashboard
, try usingvertical_layout: scroll
. (Default isfill
.)