I'm trying to produce a word document from an rmarkdown file that includes graphs/plots sized to a height of 4 inches and a width of 6.5 inches (which should take up all the width of a normal letter sized page with regular 1-inch margins on each side). However, after knitting to Word, the figures are being automatically resized/rescaled (they end up being 3.59in by 5.83in). I've tried setting the figure parameters using fig.width/height and out.width/height but that doesn't seem to solve the issue. Is there any way to control the images so they are exactly as specified by the markdown file? Otherwise, I would have to go into Word and change each individual image size by hand. Thank you in advance for your help.
Here is the code I'm using:
---
title: "Title"
author:
- "Authors"
date: "7/1/2020"
output: bookdown::word_document2
---
```{r setup, include=FALSE}
rm(list=ls(all=TRUE)) # Clear the workspace
library(tidyverse)
knitr::opts_chunk$set(echo = FALSE)
# load data
data("mtcars")
```
```{r fig-1, fig.cap="Example Figure", fig.height=4, fig.width=6.5, out.height="4in", out.width="6.5in"}
mtcars %>%
ggplot(aes(x = factor(cyl), y = mpg)) +
geom_boxplot() + theme_classic()
```
```{r fig-2, fig.cap="Example Figure", fig.height=4, fig.width=6.5, out.height="100%", out.width="100%"}
mtcars %>%
ggplot(aes(x = factor(cyl), y = mpg)) +
geom_boxplot() + theme_classic()
```
{r , fig.width = 6, fig.asp = 1}
However, I think there must be a better solution. – Amr