-
DescriptionI tried to create a pdf figure using fig-format.
The html has the figure. I was expecting to see a pdf figure in test_files/ but there is only png figure.
How do I create a pdf figure of plot(1+1) without using |
Beta Was this translation helpful? Give feedback.
Answered by
cderv
Sep 28, 2023
Replies: 1 comment 5 replies
-
In R, figures are handled by "graphic devices", you have to use those, see https://bookdown.org/yihui/rmarkdown-cookbook/graphical-device.html ---
title: "test"
format: html
---
```{r}
#| dev: pdf
plot(1 + 1)
``` You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````qmd
---
title: "Reproducible Quarto Document"
format: html
---
This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.
```{r}
plot(cars)
```
The end.
```` |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Two things:
fig-format
should work as this is an alias fordev
. Though this requires latest knitr and possibly Quarto 1.4. So in the meantime usingdev
is fine (but this options is only working for knitr chunks in .qmd)This will indeed produce a png AND a pdf file, and include only the first I believe.