0

I'm trying to make a png image longer, but any setting I change has no effect. Following this, three different attempts are shown below. The options change the ggplot object in the last chunk properly. I am using RMarkdown and knitr.

```{r setup, include=FALSE, echo=FALSE}
knitr::opts_chunk$set(fig.width=9, fig.height=6) 

library(RODBC)
library(data.table)
library(Matrix)
library(doParallel)
library(tidyverse)
library(gridExtra)

```

```{r , echo=FALSE, fig.height=50 }
knitr::include_graphics("data_sim_plot.png")
```

```{r , echo=FALSE, out.height=50, fig.height=50 }
knitr::include_graphics("data_sim_plot.png")
```

```{r , echo=FALSE, out.height=50, fig.height=50 }
knitr::opts_current$set(fig.height=20) 
knitr::include_graphics("data_sim_plot.png")
```


```{r, echo=FALSE}
# a different ggplot object
readRDS("gg.rds")
```
gabagool
  • 640
  • 1
  • 7
  • 18

1 Answers1

0
```{r , echo=FALSE, out.width= "500px"}
knitr::include_graphics("index.jpg")


```{r , echo=FALSE, out.width= "800px" }
knitr::include_graphics("index.jpg")

They gave pictures with different length. Is this what you want?

  • It results in different lengths only up to a certain width. For example, 1000px results in the same dimensions as 10000px. I think I didn't realize that 1. knitr::opts_chunk$set(fig.width=9, fig.height=6) sets the maximum sizes and you cannot exceed those and 2. the aspect ratio of the image is locked. I think I need to adjust the aspect ratio myself – gabagool Aug 20 '19 at 21:00