adjust size of png images in a rasterGrob object
0
0
Entering edit mode
3.7 years ago
Assa Yeroslaviz ★ 1.9k

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

enter image description here

rasterGrob PNG Rmarkdown layout • 933 views
ADD COMMENT

Login before adding your answer.

Traffic: 1646 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6