I am trying to change the height and width of an image with no success. The image needs to be put in an powerpoint presentation which works just fine. But for some reason it keeps stretching the image across the slide.
After creating the image and saving it into an powerpoint presentation I get this. If you look at the letters they seem stretched. example1
What I realy want is like the following example. example2
I understand that this could be done manualy for every image in the powerpoint presentation by simply adjusting the image. But as I need to create more than just one powerpoint, It is not realy desired to do it manualy.
The code I use to save the image:
#-------------------------------------------------#
#--------Create grid list of all graphs-----------#
#-define the rows of which the graphs are ordered-#
#-------------------------------------------------#
Finangrid <- grid.arrange(
fig1, fig2, fig3,
nrow = 1
)
#-------------------------------------------------#
#-------------Save grid list to file--------------#
#----------It creates file if not exist-----------#
#-------------------------------------------------#
ggsave("Financieel.png",
plot = Finangrid,
device = "png",
scale = 2,
width = 7,
height = 5,
units = c("in")
)
And the code to export the image into an powerpoint presentation:
loc_body1 <- ph_location_type(type = "body", position_right = TRUE, position_top = TRUE)
loc_body2 <- ph_location_type(type = "body", position_right = FALSE, position_top = TRUE)
doc <- read_pptx("prestest.pptx")
doc <- doc %>% on_slide(index = 24) %>%
ph_with(external_img("Financieel.png"), location = loc_body1)
fileout <- "prestest.pptx"
print(doc, target = fileout)