-
DescriptionHey, I tried to understand why size of the two output plots in below r chunks of my qmd file are different (HTML get doubled the dimension of Thanks in advance for any advice and help on my problem. ---
title: "q1"
format: html
editor: visual
---
```{r}
library(ggplot2)
library(ragg)
library(palmerpenguins)
p <- ggplot(na.omit(penguins), aes(x = flipper_length_mm, y = body_mass_g)) +
geom_point(
aes(color = species, shape = species),
size = 3,
alpha = 0.8
)
pngfile <- fs::path(knitr::fig_path(), "basis.png")
agg_png(pngfile, width = 7.8, height = 4.68, units = "in", res = 300)
plot(p)
invisible(dev.off())
```
```{r}
#| label: eight-plot
#| message: false
#| warning: false
#| fig-width: 7.8
#| fig-height: 4.68
#| fig-dpi: 300
#| fig-align: center
#| out-width: "70%"
p
```
The end. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Could you format properly the code? 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.
knitr
setsfig.Retina
to 2.There are several blog post showing this, see for example http://zevross.com/blog/2017/06/19/tips-and-tricks-for-working-with-images-and-figures-in-r-markdown-documents/.
Could you format properly the code?
You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four
````
).