0

When converting rmarkdown into PDF, is it possible to determine the position (on the page) and the size of the chart very precisely according to my needs?

1 Answers1

0

Using the Pagedown package you can position elements as you need.

When you put in a figure using an R code chunk, you can give it a caption like so:

```{r, example-label, echo=FALSE, message=FALSE, warning=FALSE, fig.cap="Example Chart"}

ggplot whatever
```

When you knit the document it'll then output your plot as a figure, which will be in a html img tag. The caption from the code chunk will then be assigned as the alt property of the img.

Then you can target the image using CSS. For example:

img[alt="Example Chart"] {
  display: none;
}

Alternatively, you could simply put in an image using markdown and then give it a style, like so:

![*An Example Image*](images/example.png){class="" style="display: block; margin-left: auto; margin-right: auto; width:50%;"}

In short, Pagedown can give you the ability to position and size charts as you want, if you're comfortable with CSS and/or HTML.