adjust size of png images in a rasterGrob object
0
0
Entering edit mode
16 months ago
Assa Yeroslaviz ★ 1.7k

I am having difficulties adjusting the size of my images in an Rmarkdown page (html output). I have three png files i'm trying to set together, 2 images at the top and one below.

The snippet I use is this one

library(png)
library(grid)
library(gridExtra)
img1 <-  rasterGrob(as.raster(readPNG("Figures1.png")), interpolate = FALSE)
img2 <-  rasterGrob(as.raster(readPNG("Figures2.png")), interpolate = FALSE)
img3 <-  rasterGrob(as.raster(readPNG("Figures3.png")), interpolate = FALSE)
lay <- rbind(c(1,2),
c(3,3))
grid.arrange(img1, img2, img3, layout_matrix = lay)


The results looks the way I want it, but the image are too small. Is there a way to make them bigger? I want the two image at the top to have no space between them and all three to take as much space as possible on the page.

Any kind of help will be appreciated.

thanks

rasterGrob PNG Rmarkdown layout • 387 views