I am creating a gtable consisting of 3 x ggplot grobs using cbind, but I would like to make the middle column less wide than the 1st and 3rd column. How would I go about doing this?
The centre column only contains text so does not need equal width to the other columns containing charts:
library(grid)
# get ggplot grob
p4grob <- ggplotGrob(p4)
gdp4grob <- ggplotGrob(gdp4)
labels4grob <- ggplotGrob(labels4)
gt = cbind(gdp4grob, labels4grob, p4grob)
grid.newpage()
grid.draw(gt)
Many thanks!

Good suggestion in comments to use
gridExtra. Much easier. But, as mentioned, I still had to do a couple of simple hacks to ensure the 3 x ggplots aligned properly, becausegrid.arrangebottom-aligns the content of a column (a bit odd and I didn't overcome this).My resulting
grid.arrangecode is as-follows, and totally moves away from using extracted grobs and cbind and leaves it togridExtra::grid.arrange()Note that I actually created 5 columns, with the left-most and right-most columns being
NULL, just because the output was cropping the numbers in the x-axis, and that was how I added a small amount of padding to the chart.Also, obviously a few additional features used working towards the final product (e.g. don't confuse
paddingwith padding the overall chart/grid/table because it is just padding the title).I also ended up using
cowplotto adjust the theme of the resulting variable fromgrid.arrange, explaining the change in appearance to blue background (and a few other alterations were done inggplot2prior to final product, so the change in appearance is not resulting from usinggrid.arrange()).Also note that I added
fig.hidefor the original R Markdown chunk because I couldn't stopgrid.arrange()from outputting the chart, even when I was assigning it to a variable, so had to hide it via R Markdown tags, and then put thecowplotplot in a separate chunk for output.