Skip to content
Discussion options

You must be logged in to vote

If you're producing a document with two separate formats, then it's probably a better idea to do something like

---
title: "embed"
format: 
  html: default
  pdf: default
---

```{r}
#| warning: false
ggplot2::qplot(1:10, (1:10)^2)
```

And now your HTML document will have bitmap (PNG) images, and your PDF document will have vector (PDF) images.

If you're not using quarto to produce your thesis, then you can do something like

```{r}
#| warning: false
fig <- ggplot2::qplot(1:10, (1:10)^2)
ggsave("out.pdf", fig, device="PDF")
fig
```

Which would produce "out.pdf" as a side effect of knitting your HTML document, while displaying the HTML document with a PNG image.

Replies: 3 comments 14 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
14 replies
@baptiste
Comment options

@mcanouil
Comment options

@baptiste
Comment options

@mcanouil
Comment options

@cderv
Comment options

Answer selected by nclJoshCowley
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants